实习生黄瓜插件错误:名为"cucumber"的插件尚未注册 [英] Intern-cucumber plugin error: A plugin named "cucumber" has not been registered

查看:140
本文介绍了实习生黄瓜插件错误:名为"cucumber"的插件尚未注册的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用实习黄瓜插件.我收到以下错误:

I'm trying to get the intern-cucumber plugin working. I get the following error:

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配置文件如下:

Any ideas on how to solve this? My intern.json configuration file looks like:

{
  "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"
  }

}

我的测试文件中发生了错误,additioning.js看起来像:

And my test file, where the error is happening, addition.js looks like:

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文件有问题吗?

Does anyone have ANY idea how to solve this? No idea why the plugin wouldn't work, is there something wrong with my intern.json file??

推荐答案

代码正在调用intern.getPlugin('cucumber').它实际上应该调用intern.getPlugin('interface.cucumber')intern.getInterface('cucumber')(首选前者).

The code is calling intern.getPlugin('cucumber'). It should actually be calling intern.getPlugin('interface.cucumber') or intern.getInterface('cucumber') (the former is preferred).

实习生有一个专门用于注册和检索接口(registerInterfacegetInterface)的API.但是,它只是通用插件API(registerPlugingetPlugin)的一个薄包装,将interface.添加到了插件名称.将来可能会删除接口API,而只使用单个插件API.

Intern has an API specifically for registering and retrieving interfaces (registerInterface and getInterface). However, it's just a thin wrapper around the general plugin API (registerPlugin and getPlugin) that adds interface. to the plugin name. The interface API will likely be removed in the future in favor of just having the single plugin API.

这篇关于实习生黄瓜插件错误:名为"cucumber"的插件尚未注册的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆