Why running jasmine from cli works but through a grunt task it fails?

241 Views Asked by At

When I run jasmine without grunt the test runs perfectly but when run with the grunt jasmine task it fails.

I think the reason for this may be because grunt is running the specs with a headless phantom js browser. While the command line jasmine just runs the tests locally.

Running from CLI: jasmine

Started
.
1 spec, 0 failures
Finished in 0.005 seconds

Running with 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

There are 0 best solutions below