I am using following gulp task to execute the karma/jasmine unit test cases . however i was not able access the karma.conf.js file for some reason. this problem occurs when i use this path
package to access the karma.conf.js file.
gulp task
gulp.task('tdd', function (done) {
karma.start({
configFile: fs.readFile(path.join(__dirname, '../Tests/karma.conf.js')),
singleRun: true
}, done);
});
error i am getting
PS C:\Users\dell pc\Documents\Work\WebApiRole> gulp tdd
[13:47:58] Using gulpfile ~\Documents\Work\WebApiRole\Gulpfile.js
[13:47:58] Starting 'tdd'...
INFO [karma]: Karma v0.12.32 server started at http://localhost:9876/
It just wait forever in above state .
But when just access the file like this configFile: __dirname, '../Tests/karma.conf.js'
(without fs.readFile(path.join) then the gulp access the karma.conf.js
file successfully .
can someone give me an idea regarding what i am doing wrong here ?
configFile
property is just a file name. So when you provide__dirname + '../Tests/karma.conf.js'
it corresponds to the actual file location. You can actually do:With
fs.readFile
you read a file and provide its contents to the karma runner. I am not sure why you are not getting any error.