Skip to content

Commit bd4eacc

Browse files
committed
Merge pull request #3624 from AgDude/grunt
Enh(grunt): add "feature" option to test only one feature
2 parents d68dcc6 + eaf35b4 commit bd4eacc

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

lib/grunt/utils.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ var util = module.exports = {
1717
unit: ['src/js/core/bootstrap.js', 'src/js/**/*.js', 'test/unit/**/*.spec.js', 'src/features/*/js/**/*.js', 'src/features/*/test/**/*.spec.js', '.tmp/template.js'],
1818
core_unit: ['src/js/core/bootstrap.js', 'src/js/**/*.js', 'test/unit/**/*.spec.js', 'src/features/*/js/**/*.js', '.tmp/template.js'],
1919
},
20+
testFilesFeature: function(featureName){
21+
var featurePattern = 'src/features/' + featureName +'/test/**/*.spec.js';
22+
23+
return {
24+
unit: ['src/js/core/bootstrap.js', 'src/js/**/*.js', 'test/unit/**/*.spec.js', 'src/features/*/js/**/*.js', featurePattern, '.tmp/template.js'],
25+
core_unit: util.testDependencies.unit.core_unit
26+
};
27+
},
2028

2129
// Return a list of angular files for a specific version
2230
angularFiles: function (version) {
@@ -211,12 +219,20 @@ var util = module.exports = {
211219
.concat(util.testFiles.core_unit))
212220
}
213221
});
222+
} else if ( grunt.option('feature') ){
223+
grunt.config('karma.' + karmaConfigName, {
224+
options: {
225+
files: util.testDependencies.unit
226+
.concat(util.angularFiles(version)
227+
.concat(util.testFilesFeature(grunt.option('feature')).unit))
228+
}
229+
});
214230
} else {
215231
grunt.config('karma.' + karmaConfigName, {
216232
options: {
217233
files: util.testDependencies.unit
218234
.concat(util.angularFiles(version)
219-
.concat(util.testFiles.unit))
235+
.concat(util.testFiles.unit))
220236
}
221237
});
222238
}

0 commit comments

Comments
 (0)