I'm trying to execute a gulp task to run Karma after upgrading to Angular 6. Following the example in the readme on gulp-karma,
var gulp = require('gulp');
var Server = require('karma').Server;
/**
* Run test once and exit
*/
gulp.task('test', function (done) {
new Server({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done).start();
});
I see this error in the output:
Error: The '@angular-devkit/build-angular/plugins/karma' karma plugin is meant to be used from within Angular CLI and will not work correctly outside of it.
It seems like either gulp needs to run karma through angular-cli or the options and overrides provided to the task need to change.
I'm using:
- "@angular/cli": "~6.0.8"
- "karma": "^1.7.1"
- "gulp-util": "^3.0.8"
Can someone please provide the correct initialization to make Karma test work in this scenario?