gulp任务找不到karma.conf.js [英] gulp task can't find karma.conf.js
问题描述
gulp.task('tdd',function(done){
新服务器({
configFile:'karma.conf.js'
},done).start();
});
这是我使用Gulp
var karma = require('karma');这两个文件位于同一个根目录中。
gulp.task('karma',function(done){
karma.server.start({
configFile:__dirname +'/karma.conf.js'
},done);
});
更新
如果您运行的是NODE.js,那么
NODE Explnation for __dirname链接
当前正在执行的脚本所在目录的名称。
如果您没有运行NODE.js,那么您可能需要的只是
configFile:'/karma.conf.js'
但是如果你正在运行NODE然后使用第一个示例。
I am trying to run karma test via a gulp task. I use https://github.com/karma-runner/gulp-karma and for some reason gulp cannot locate my karma.conf.js. That file is located in the same folder as the gulpfile. The root of the project. No matter what path I put, I get the same error File ./karma.conf.js does not exist. I cannot figure out how to path it correctly. Here is the code for the gulp task.
gulp.task('tdd', function (done) {
new Server({
configFile: 'karma.conf.js'
}, done).start();
});
This is how I spool up karma using Gulp ( and both files are in the same root ).
var karma = require('karma');
gulp.task('karma', function (done) {
karma.server.start({
configFile: __dirname + '/karma.conf.js'
}, done);
});
UPDATE
If you are running NODE.js then
NODE Explnation for __dirname link
"The name of the directory that the currently executing script resides in."
If you are not running NODE.js, then perhaps all you needed was
configFile: '/karma.conf.js'
But if you are running NODE then use the first example.
这篇关于gulp任务找不到karma.conf.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!