preboot/angularjs-webpack

How to debug karma unit tests?

stefek99 opened this issue · 1 comments

  1. Installed npm install karma-chrome-launcher --save-dev
  2. Added following to package.json: "test-debug": "karma start --browsers=Chrome --single-run=false"
  3. When running npm start test-debug I'm getting following error:
Chrome 51.0.2704 (Mac OS X 10.11.5) ERROR
  Uncaught Error: Cannot find module "./app"
  at http://localhost:9876/context.html:5

Workaround

Edit karma.conf.js and override --browsers=Chrome --single-run=false


Any ideas how to make it better?

phra commented

just install karma-chrome-launcher as development dependency and add chrome to karma browsers list in webpack config.

browsers: [
      // Run tests using PhantomJS
      'PhantomJS',
      'Chrome'
    ]