我正在使用yeoman角度生成器。在这个生成器中,测试被放置在一个单独的文件夹'test'
中。我宁愿把它们和我的.js文件放在同一个文件夹里。我给他们起了个名字.spec.js
。我需要在我的Gruntfile.js
文件中修复这个问题,这样它们就不会包含在缩小、jshint等中
我是否可以排除以.spec.js结尾的文件?
// Make sure there are no obvious mistakes
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
all: {
src: [
'Gruntfile.js',
'<%= yeoman.app %>/scripts/{,*/}*.js'
]
},
test: {
options: {
jshintrc: 'test/.jshintrc'
},
src: ['test/spec/{,*/}*.js']
}
},
在表达式前面使用!
可以忽略它:
E.g:!**/*.spec.js
在您的情况下:
all: {
src: [
'!**/*.spec.js',
'Gruntfile.js',
'<%= yeoman.app %>/scripts/{,*/}*.js'
]
},
test: {
options: {
jshintrc: 'test/.jshintrc'
},
src: ['!**/*.spec.js','test/spec/{,*/}*.js']
}