6

Directory structure :

  • WebApiRole
    • GulpFile.js
  • test
    • Karma.conf.js

Gulp code from GulpFile.js

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

So my problem going to the parent directory and access the karma.conf.js . For some reason the path is not get resolved with ..\\ to go back to the parent directory of WebApiRole . can someone point me in the right direction ?

Malik
  • 2,430
  • 5
  • 27
  • 41

1 Answers1

15

I had to use path package to resolve this issue .

var path = require("path"),
    fs = require("fs");

gulp.task('test', function (done) {
    karma.start({
        configFile: fs.readFile(path.join(__dirname, '../test/', 'karma.conf.js')),
        singleRun: true
    }, done);
});
Malik
  • 2,430
  • 5
  • 27
  • 41