How do I fix my generator-angular project so that grunt test works?

我与影子孤独终老i 提交于 2019-12-02 21:56:12

I seem to have fixed my problem, for anyone with a similar problem:

Within my karma.conf.js I added the following:

plugins: [
    'karma-chrome-launcher',
    'karma-jasmine'
    ],

At first I added 'karma-jasmine' but was then met with "Can not load "Chrome", it is not registered!" This was solved by adding 'karma-chrome-launcher' as a plug-in

Not sure if it was my fault or whether generator-angular is out of date, but it is now working.

The github issue pointed out by @Jim Schubert has this comment:

The full list of karma dependencies that I needed to install to get tests working (coffeescript).

npm install --save-dev karma-chrome-launcher karma-firefox-launcher karma-safari-launcher karma-opera-launcher karma-ie-launcher karma-jasmine karma-coffee-preprocessor

If you used the --coffee flag on the yo angular command you'll need to:

install some browser launcher (chrome in this case) and the following npm packages:

npm install --save-dev karma-chrome-launcher karma-jasmine karma-coffee-preprocessor

and add the following to your karma.conf.js file:

plugins:['karma-chrome-launcher', 'karma-jasmine', 'karma-coffee-preprocessor'],
preprocessors:{'**/*.coffee':['coffee']}

After that running grunt test should work.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!