forked from angular-ui/bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrunt.js
78 lines (71 loc) · 2.19 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
lint: {
files: ['grunt.js', 'common/*.js', 'directives/**/*.js']
},
watch: {
files: '<config:lint.files>',
tasks: 'lint test-run'
},
concat: {
build: {
src: ['common/common.js', 'directives/*/*.js'],
dest: 'build/angular-ui-bootstrap.js'
}
},
jshint: {
options: {
curly: true,
immed: true,
newcap: true,
noarg: true,
sub: true,
boss: true,
eqnull: true
},
globals: {}
}
});
//register before and after test tasks so we've don't have to change cli options on the goole's CI server
grunt.registerTask('before-test', 'lint');
grunt.registerTask('after-test', 'concat');
// Default task.
grunt.registerTask('default', 'before-test test after-test');
// Testacular configuration
var runTestacular = function(command, options) {
var testacularCmd = process.platform === 'win32' ? 'testacular.cmd' : 'testacular';
var args = [command, 'test/test-config.js'].concat(options);
var done = grunt.task.current.async();
var child = grunt.utils.spawn({
cmd: testacularCmd,
args: args
}, function(err, result, code) {
if (code) {
done(false);
} else {
done();
}
});
child.stdout.pipe(process.stdout);
child.stderr.pipe(process.stderr);
};
grunt.registerTask('test', 'run tests on single-run server', function() {
var options = ['--single-run', '--no-auto-watch'];
if (process.env.TRAVIS) {
options = options.concat(['--browsers=Firefox']);
} else {
//Can augment options with command line arguments
options = options.concat(this.args);
}
runTestacular('start', options);
});
grunt.registerTask('server', 'start testacular server', function() {
var options = ['--no-single-run', '--no-auto-watch'].concat(this.args);
runTestacular('start', options);
});
grunt.registerTask('test-run', 'run tests against continuous testacular server', function() {
var options = ['--single-run', '--no-auto-watch'].concat(this.args);
runTestacular('run', options);
});
};