forked from pkozlowski-opensource/angularjs-mongolab
-
Notifications
You must be signed in to change notification settings - Fork 1
/
grunt.js
61 lines (56 loc) · 1.63 KB
/
grunt.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
src: {
js: ['src/**/*.js']
},
test: {
js: ['test/**/*Spec.js']
},
lint:{
files:['grunt.js', '<config:src.js>', '<config:test.js>']
},
jshint:{
options:{
curly:true,
eqeqeq:true,
immed:true,
latedef:true,
newcap:true,
noarg:true,
sub:true,
boss:true,
eqnull:true
},
globals:{}
}
});
// Default task.
grunt.registerTask('default', 'lint test');
// Testacular stuff
var testacularCmd = process.platform === 'win32' ? 'testacular.cmd' : 'testacular';
var testConfigFile = 'test-config.js';
var runTestacular = function(cmd, options) {
var args = [cmd, testConfigFile].concat(options);
var done = grunt.task.current.async();
var child = grunt.utils.spawn({cmd:testacularCmd, args:args}, function (err, result, code) {
if (code) {
grunt.fail.fatal("Test failed...");
}
done();
});
child.stdout.pipe(process.stdout);
child.stderr.pipe(process.stderr);
};
grunt.registerTask('test-watch', 'watch file changes and test', function() {
var options = ['--auto-watch', '--reporters=dots', '--no-single-run'];
runTestacular('start', options);
});
grunt.registerTask('test', 'run testacular tests', function () {
var options = ['--single-run', '--no-auto-watch', '--reporter=dots'];
if (process.env.TRAVIS) {
options.push('--browsers=Firefox');
}
runTestacular('start', options);
});
};