为什么从cli运行jasmine但是通过一个笨拙的任务失败了?

时间:2016-01-26 07:54:51

标签: javascript jasmine grunt-contrib-jasmine

当我运行jasmine without grunt时,测试运行得很好但是当使用grunt jasmine task运行时,它会失败。

我认为这可能是因为grunt正在使用headless phantom js browser运行规范。虽然命令行jasmine只是在本地运行测试。

从CLI运行:jasmine

Started
.
1 spec, 0 failures
Finished in 0.005 seconds

使用Grunt-cli运行:grunt jasmine

Running "jasmine:test" (jasmine) task
Testing jasmine specs via PhantomJS

 common JS Tests
   X encountered a declaration exception
     Error: Module name "src/common" has not been loaded yet for context: _. Use require([])
http://requirejs.org/docs/errors.html#notloaded in file:///home/surfer190/projects/MyProj/src/js/libs/require.js (line 8) (1)

1 spec in 0.006s.
>> 1 failures
Warning: Task "jasmine:test" failed. Use --force to continue.

Aborted due to warnings.

Gruntfile.js:

jasmine: {
          test: {
            options: {
              specs: 'spec/**/*.spec.js',
              vendor: [
                'src/js/libs/require.js',
              ]
            }
          }
        },

jasmine.json:

{
  "spec_dir": "spec",
  "spec_files": [
    "**/*.[sS]pec.js"
  ],
  "helpers": [
    "helpers/**/*.js"
  ],
  "stopSpecOnExpectationFailure": false,
  "random": false
}

0 个答案:

没有答案