Javascript Intern cucumber插件错误:名为“的插件”;黄瓜“;尚未注册
我在试着让实习生工作。我得到以下错误:Javascript Intern cucumber插件错误:名为“的插件”;黄瓜“;尚未注册,javascript,plugins,dojo,cucumber,intern,Javascript,Plugins,Dojo,Cucumber,Intern,我在试着让实习生工作。我得到以下错误: Error: A plugin named "cucumber" has not been registered at Node.BaseExecutor.getPlugin @ src\lib\executors\Executor.ts:387:12 @ tests\addition.js:6:29 at runFactory @ node_modules\dojo\dojo.js:1134:43 at execModule @ node
Error: A plugin named "cucumber" has not been registered
at Node.BaseExecutor.getPlugin @ src\lib\executors\Executor.ts:387:12
@ tests\addition.js:6:29
at runFactory @ node_modules\dojo\dojo.js:1134:43
at execModule @ node_modules\dojo\dojo.js:1262:5
at execModule @ node_modules\dojo\dojo.js:1253:12
@ node_modules\dojo\dojo.js:1297:6
at guardCheckComplete @ node_modules\dojo\dojo.js:1277:5
at checkComplete @ node_modules\dojo\dojo.js:1292:4
at contextRequire @ node_modules\dojo\dojo.js:835:6
at req @ node_modules\dojo\dojo.js:124:11
@ src\loaders\dojo.ts:36:8
at new Promise @ anonymous
at Node._loader @ src\loaders\dojo.ts:29:13
at Node._loadFunctionalSuites @ src\lib\executors\Node.ts:593:29
@ src\lib\executors\Node.ts:882:24
@ node_modules\@theintern\common\index.js:16:7174
有没有办法解决这个问题?我的intern.json配置文件如下所示:
{
"loader": {
"script": "dojo",
"options": {
"packages": [
{
"name": "features",
"location": "features"
},
{
"name": "models",
"location": "models"
},
{
"name": "dojo",
"location": "node_modules/dojo"
}
]
}
},
"functionalSuites": "tests/**.js",
"environments": [ "chrome" ],
"browser": {
"plugins": [
"node_modules/intern-cucumber/browser/plugin.js"
]
},
"node": {
"plugins": "node_modules/intern-cucumber/plugin.js"
}
}
我的测试文件(发生错误的地方)addition.js如下所示:
define([
'models/calculator',
'dojo/text!features/addition.feature'
], function (calculator, featureSrc) {
const cucumber = intern.getPlugin('cucumber');
const assert = intern.getPlugin('chai').assert;
cucumber.registerCucumber('Calculator addition', featureSrc, function () {
cucumber.Given('the calculator is cleared', function () {
});
cucumber.When(/^I add (\d+) and (\d+)$/, function (x, y) {
var calc = new Calculator(x, y)
})
cucumber.Then(/^the result should be (\d+)$/, function (z) {
var result = calc.sum();
assert.equal(z,result,'Expected result to be: ' + z)
})
}
)
}
)
有人知道如何解决这个问题吗?不知道为什么插件不能工作,我的intern.json文件是否有问题???代码正在调用
intern.getPlugin('cumber')
。它实际上应该调用intern.getPlugin('interface.cumber')
或intern.getInterface('cumber')
(首选前者)
Intern有一个专门用于注册和检索接口的API(registerInterface
和getInterface
)。然而,它只是普通插件API(registerPlugin
和getPlugin
)的一个薄薄的包装,它为插件名称添加了接口。
。接口API将来可能会被删除,而只使用单一插件API