测试使用cucumberjs但不是业力

时间:2016-06-20 08:53:53

标签: karma-runner cucumberjs

当我使用./node_modules/.bin/cucumberjs tests/features启动测试时,它们运行正常,但是当我使用npm test启动测试时,我收到以下错误:

20 06 2016 10:40:37.610:INFO [Firefox 44.0.0 (Ubuntu 0.0.0)]: Connected on socket /#0o9c3SofFmLLUL3AAAAB with id 99491078
    Firefox 44.0.0 (Ubuntu 0.0.0) ERROR
      ReferenceError: setImmediate is not defined
      at node_modules/cucumber/release/cucumber.js:211

有人知道发生了什么吗?

这是我的package.json文件:

{
  "name": "...",
  "version": "1.0.0",
  "description": "...",
  "main": "googlemappers.js",
  "devDependencies": {
    "chai": "^3.5.0",
    "cucumber": "^0.10.4",
    "jquery": "^3.0.0",
    "karma": "^0.13.22",
    "karma-chai": "^0.1.0",
    "karma-cucumber-js": "^0.2.0",
    "karma-firefox-launcher": "^1.0.0",
    "karma-mocha": "^1.0.1",
    "mocha": "^2.5.3"
  },
  "scripts": {
    "test": "karma start karma.conf.js"
  },
  "repository": {
    "type": "git",
    "url": "..."
  },
  "author": "...",
  "license": "",
  "homepage": "..."
}
  },

这是我的karma.conf.js:

module.exports = function(config) {
  config.set({
    basePath: '',
    frameworks: [
        'mocha',
        'chai',
        'cucumber-js'
    ],
    files: [
        'src/*.js',
        'tests/features/*.feature'
    ],
    exclude: [
    ],
    preprocessors: {
    },
    reporters: ['progress'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['Firefox'],
    singleRun: false,
    concurrency: Infinity
  })
}

1 个答案:

答案 0 :(得分:0)

将黄瓜降级为0.10.3(没有主要插入符号,因为显然 0.10.30.10.4之间发生了重大变化)为我解决了问题