Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Karma.conf.js does not exist

I just reinstalled node from scratch. I also installed yeoman, generator-angular, and karma.

After generating a project with yo angular, I can successfully grunt serve. However, whenever I try grunt test, the following error is thrown:

karma.conf.js does not exist

However, karma.conf.js does indeed exist in the generated test directory. Why would this happen?

like image 275
mortsahl Avatar asked May 31 '14 02:05

mortsahl


1 Answers

Gruntfile.js refers to karma.conf.js in the root-dir. The Angular generator puts it in the test-directory, so you'll need to update Gruntfile.js

// Test settings
karma: {
  unit: {
    configFile: 'test/karma.conf.js',
    singleRun: true
  }
}

There's also a problem when running grunt test with this generated karma.conf.js. It will say

test/karma.conf.js:63
    colors: true,
    ^^^^^^
ERROR [config]: Invalid config file!
  SyntaxError: Unexpected identifier

Reason: comma missing after 'singleRun: false'.

like image 188
elimelech Avatar answered Jan 04 '23 01:01

elimelech