我有一个像这样的 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'
的文件,这可能吗?
最佳答案
你应该为你的文件使用完整的模式语法,这样你就可以禁用对你不想要的文件的监视:
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
.
"If
autoWatch
istrue
all files that have setwatched
totrue
will be watched for changes."
关于javascript - Karma 监视特定文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22174949/