My team is working on moving from Grunt to Gulp. I have a Grunt test task that works fine, but when I try to run the tests (using gulp-karma) I get an error that says "ReferenceError: Can't find variable: module"
I Googled and found a lot of posts saying to check the location of my angular-mocks.js file, and it's in the correct space (my Grunt task for the same code does work).
To verify that it wasn't something weird in my code a spun up a new yo angular app and was able to replicate the error.
My guess is that I'm missing a configuration value or a step or something. Any advice?
Thanks.
The answer by @mcranston18 will absolutely work. But as an alternative option, gulp-karma
is currently an unnecessary plugin. Part of the advantage of gulp
is that you don't have to use a plugin for everything under the sun. Instead, you can wire into karma
directly.
var gulp = require('gulp');
var karma = require('karma').server;
gulp.task('tests', function(done) {
return karma.start({
configFile: __dirname + '/test/karma.conf.js',
singleRun: true
}, done);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With