Using:
ng test
Angular CLI runs the tests by default in Chrome, which is great, but what if I need to run them in a console-only environment (h
This should do the trick:
npm i --save-dev karma-phantomjs-launcher
Then modify the plugins property of the karma.conf.js file, adding the PhantomJS plugin to the list. Also add PhantomJS to the browsers property.
plugins: [
require( 'karma-jasmine' ),
require( 'karma-chrome-launcher' ),
require( 'karma-phantomjs-launcher' ),
require( 'karma-remap-istanbul' ),
require( 'angular-cli/plugins/karma' )
],
...
browsers: [ 'PhantomJS', 'Chrome' ],
Since you want a completely headless experience, you can remove Chrome from the browsers property, and remove the karma-chrome-launcher from the plugins array as well.