我有karma.conf.js
这样:
module.exports = function(config){
config.set({
files : [
'static_dev/js/lib/underscore-min.js',
'static_dev/js/lib/angular.1.2.9.min.js',
'static_dev/js/lib/angular-cookies.1.1.5.min.js',
'static_dev/js/lib/ui-bootstrap-custom-tpls-0.10.0.js',
'static_dev/js/lib/angular-tags-0.2.10-tpls.min.js',
'static_dev/js/lib/angular-mocks.js',
'static_dev/js/angular/modules/*.js',
'static_dev/js/angular/controllers/**/*.js',
'static_dev/js/angular/directives/**/*.js',
'static_dev/js/angular/services/**/*.js',
'static_dev/js/angular/**/test/*.js'
],
reporters: ['progress', 'coverage'],
autoWatch: true,
colors: true,
frameworks: ['jasmine'],
browsers : ['PhantomJS'],
})}
一切正常,但是我想“自动观看”仅匹配'static_dev/js/angular/**/test/*.js'
的文件,这可能吗?
答案 0 :(得分:5)
您应该使用文件的完整模式语法,这样您就可以禁用观看您不想要的文件:
files : [
//this pattern will NOT be watched
{pattern: 'path/to/**/*.js', watched: false, included: true, served: true},
//this one will be watched
{pattern: 'path/to/other/**/*.js', watched: true, included: true, served: true}
],
autowatch: true
请注意,watched
,included
和served
默认值为 true
。
“如果
autoWatch
为true
,则会监视已将watched
设置为true
的所有文件进行更改。”
答案 1 :(得分:2)
files : [
...
{
pattern: 'static_dev/js/angular/**/test/*.js',
watched: true
}
]
尝试这个