I'm using the yeoman angular generator. In this generator the test are placed in a seperate folder 'test'
. I rather keep them in the same folder as my .js files. I give them the name .spec.js
. I need to fix this in my Gruntfile.js
file so they are not included in minification, jshint etc.
Is there anyway I can exclude files ending with .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']
}
},
Use !
in front of an expression to ignore it :
E.g : !**/*.spec.js
In your case :
all: {
src: [
'!**/*.spec.js',
'Gruntfile.js',
'<%= yeoman.app %>/scripts/{,*/}*.js'
]
},
test: {
options: {
jshintrc: 'test/.jshintrc'
},
src: ['!**/*.spec.js','test/spec/{,*/}*.js']
}