Trying to run karma using gulp for running tests but after following the example from: https://github.com/karma-runner/gulp-karma
My gulp file:
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();
});
/**
* Watch for file changes and re-run tests on each change
*/
gulp.task('tdd', function (done) {
new Server({
configFile: __dirname + '/karma.conf.js'
}, done).start();
});
gulp.task('default', ['tdd']);
after I run: gulp test I get the Error:
TypeError: Server is not a function at Gulp.<anonymous>
Any suggestions of what might be wrong?
The issue was that karma-cli npm module wasn't properly installed globally. Running: npm install -g karma-cli
solved the issue.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.