generator-angular
generator-angular copied to clipboard
"grunt test" throws "karma.conf.js does not exist"
I'm using angular generator version 0.15.1. These packages, among others, are in my package.json:
{
"devDependencies": {
"grunt-karma": "^0.12.1",
"jasmine-core": "^2.4.1",
"karma": "^0.13.21",
"karma-chrome-launcher": "^0.2.2",
"karma-jasmine": "^0.3.7",
"karma-phantomjs-launcher": "^1.0.0",
"phantomjs-prebuilt": "^2.1.4"
}
}
I have no karma.conf.js file in the test folder nor anywhere else.
When I run grunt test, I get
Running "karma:unit" (karma) task
26 02 2016 20:58:22.744:ERROR [config]: File C:\Users\miparnisari\Desktop\app\test\karma.conf.js does not exist!
What version of generator-karma do you have?
I've no idea, how do I check?
npm info -g generator-karma | grep 'version:'
2.0.0
Try running yo karma
I get the following error now:
Running "connect:test" (connect) task
Verifying property connect.test exists in config...OK
File: [no files]
Options: protocol="http", port=9001, hostname="localhost", base=".", directory=null, keepalive=false, debug=false, livereload=35729, open=false, useAvailablePort=false, onCreateServer=null, middleware=undefined
Started connect web server on http://localhost:9001
Loading "grunt-karma" plugin
Registering "C:\Users\miparnisari\Desktop\vinti-landing\node_modules\grunt-karma\tasks" tasks.
Loading "grunt-karma.js" tasks...OK
+ karma
Running "karma" task
Running "karma:unit" (karma) task
Verifying property karma.unit exists in config...OK
File: [no files]
Options: background=false, client={}
04 03 2016 18:19:41.993:INFO [karma]: Karma v0.13.21 server started at http://localhost:8082/
04 03 2016 18:19:42.005:INFO [launcher]: Starting browser PhantomJS
04 03 2016 18:19:43.596:INFO [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Connected on socket /#JIoiBKHlUW4GuXvWAAAA with id 89298213
PhantomJS 2.1.1 (Windows 8 0.0.0): Executed 0 of 0 ERROR (0.004 secs / 0 secs)
Warning: Task "karma:unit" failed. Use --force to continue.
Aborted due to warnings.
It sounds like generator-karma didnt run initially when you did the generator so the files aren't setup correctly. Take a look at https://github.com/yeoman/generator-angular/blob/master/app/index.js#L99 and add those to your karma file and it should be good
Oops accidentally closed this issue. I think I did not follow the setup steps properly, I'll try again. I still don't understand how or why generators depend on each other.
path.karma is not defined correctly, you need something like this in your gulpfile.js: note: assuming angular-ui-sortable, angular-local-storage installed
var paths = {
scripts: [yeoman.app + '/scripts/**/*.js'],
styles: [yeoman.app + '/styles/**/*.scss'],
test: ['test/spec/**/*.js'],
testRequire: [
'bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js',
'bower_components/angular-resource/angular-resource.js',
'bower_components/angular-cookies/angular-cookies.js',
'bower_components/angular-sanitize/angular-sanitize.js',
'bower_components/angular-route/angular-route.js',
'bower_components/angular-animate/angular-animate.js',
'bower_components/angular-touch/angular-touch.js',
'bower_components/angular-ui-sortable/sortable.js',
'bower_components/angular-local-storage/dist/angular-local-storage.js',
'test/mock/**/*.js',
'test/spec/**/*.js'
],
karma: 'test/karma.conf.js',
views: {
main: yeoman.app + '/index.html',
files: [yeoman.app + '/views/**/*.html']
}
};