Anita Mehta Anita Mehta - 1 month ago 20
AngularJS Question

How do we can run specific test case using gulp/Karma/Jasmin and angularjs?

I have multiple files for test case in a folder and I want to run only one file, how can I do this?

Now I am giving like this:

'test/**/*.spec.js'
in
karma.conf.js


and the following code is in
gulpfile.js
-

gulp.task('test', function (done) {
new Server({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, function () {
done();
}).start();
});


Here, test is my folder where all test case js files are present.

How can I specify one js file?

Answer

Along with configFile you specify the options that will overwrite the ones from config file (e.g. singleRun).

So it has to be

gulp.task('test', function (done) {
    new Server({
        configFile: __dirname + '/karma.conf.js',
        files: ['test/some.spec.js'],
        singleRun: true
    }, function () {
        done();
    }).start();
});
Comments