forked from angular-ui/bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrunt.js
80 lines (70 loc) · 2.07 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
79
80
var testacular = require('testacular');
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
lint: {
files: ['grunt.js', 'common/*.js', 'directives/**/*.js']
},
watch: {
files: '<config:lint.files>',
tasks: 'lint test'
},
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: {}
}
});
// Default task.
grunt.registerTask('default', 'lint test concat');
grunt.registerTask('watch', 'lint test concat');
grunt.registerTask('server', 'start testacular server', function() {
var done = this.async();
testacular.server.start({configFile: 'test/test-config.js'});
});
function spawnTestacular(args, callback) {
grunt.utils.spawn({
cmd: __dirname + "/node_modules/.bin/" +
(process.platform === 'win32' ? 'testacular.cmd' : 'testacular'),
args: args
}, callback);
}
grunt.registerTask('test-run', 'run tests against continuous testacular server', function() {
var done = this.async();
spawnTestacular(['run'], function(error, result, code) {
if (error) {
grunt.warn("Make sure the testacular server is online: run `grunt server`.\n" +
"Also make sure you have a browser open to http://localhost:9018/.\n" +
grunt.warn(error.stdout + error.stderr));
setTimeout(done,1000);
} else {
grunt.log.write(result.stdout);
done();
}
});
});
grunt.registerTask('test', 'run tests on single-run server', function() {
var done = this.async();
spawnTestacular(['start', 'test/test-config.js','--single-run', '--log-level=warn'], function(error, result, code) {
if (error) {
grunt.warn(error.stdout + error.stderr);
} else {
grunt.log.write(result.stdout);
}
done();
});
});
};