3

カルマを介してジャスミンスペックを実行しようとしていますが、カルマがインクルードファイルを探すときにC:\、構成ファイルがC:\dev\project\.

gulp タスクで Karma を実行しています。

var karma = require('karma').server;
gulp.task('test', function (done) {
    karma.start({configFile: '../../../karma.conf.js', singleRun: true}, done);
});

この問題に関連する設定:

basePath: '',
files: [
 {patterns:'bower_components/**/*.js',included:true},
 {patterns:'src/*.js', included:true},
 {patterns:'tests/*Spec.js', included:true}
],
exclude: []

カルマからログを実行すると、次のようgulp testに吐き出されます。

WARN [watcher]: Pattern "C:/bower_components/**/*.js" does not match any file.
WARN [watcher]: Pattern "C:/src/*.js" does not match any file.
WARN [watcher]: Pattern "C:/tests/*Spec.js" does not match any file.

私はカルマが初めてで、ここで何が問題なのかよくわかりません。、、およびbasePathを試しました。'''./''/'

4

1 に答える 1

6

以下を使用して、basePath をローカル CWD ディレクトリ パスに設定します。

basePath: process.cwd(), //  this gets the path which gulp is running in terminal
files: [
 {patterns:'bower_components/**/*.js',included:true},
 {patterns:'src/*.js', included:true},
 {patterns:'tests/*Spec.js', included:true}
],
exclude: []

process.cwd()端末で実行されているノードのパスである CLI パスを取得します。

于 2014-06-05T00:28:59.290 に答える