在Javascript中使用require函数时,我遇到了MultipleDefine错误。我正在使用Karma,Dojo和Cucumber-js。我之前从未见过此错误,而且我真的不确定这是什么意思或如何解决!请帮忙。
我在stackoverflow上看到了类似的问题,但是它们都与esri或arcgis有关,与我正在使用的东西相去甚远。
这是我的黄瓜和业力整合的步骤文件。在我使用require添加第二行之前,一切工作正常。
'use strict';
var calc = require('../../../../../lib/calculator');
Before("@test", function(scenario) {
expect(["Test scenario 2.1", "Test scenario 1.3"].indexOf(scenario.pickle.name) !== -1).to.equal(true);
});
Given(/^there is a test step$/, function () { });
Given(/^there is an ambiguous test step$/, function () { });
When(/^it is executed$/, function () { });
When(/^it is not executed$/, function (callback) { return callback(null, 'pending'); });
Then(/^test succeeds$/, function () { });
Then(/^test fails$/, function (callback) { return callback(new Error("Step failed") ); });
我收到此错误消息:
{
"message": "Uncaught Error: undefinedModule\nat UI/Scripts/krm-cmbr/lib/dojo.js:822:21\n
\nError: undefinedModule\n
at makeError (UI/Scripts/krm-cmbr/lib/dojo.js:129:24)\n
at contextRequire (UI/Scripts/krm-cmbr/lib/dojo.js:822:27)\n
at req (UI/Scripts/krm-cmbr/lib/dojo.js:147:20)\n
at UI/Scripts/krm-cmbr/src/test/steps/steps1.js:2:12",
"str": "Uncaught Error: undefinedModule\nat UI/Scripts/Tests/krm-cmbr/lib/dojo.js:822:21\n\nError: undefinedModule\n at makeError (UI/Scripts/krm-cmbr/lib/dojo.js:129:24)\n
at contextRequire (UI/Scripts/krm-cmbr/lib/dojo.js:822:27)\n at req (UI/Scripts/Tests/krm-cmbr/lib/dojo.js:147:20)\n at UI/Scripts/Tests/krm-cmbr/src/test/steps/steps.js:2:12"
}