forked from timdream/wordcloud2.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
79 lines (69 loc) · 1.99 KB
/
Gruntfile.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
'use strict';
module.exports = function(grunt) {
var HTTPD_PORT = 28080 + Math.floor(Math.random() * 10);
var TEST_URL = 'http://localhost:' + HTTPD_PORT + '/test/';
var BASE_COMMIT = grunt.option('base-commit') ||
process.env.TRAVIS_BRANCH ||
'';
grunt.initConfig({
shell: {
'qunit-slimerjs': {
command: './test/run-slimerjs.sh ' + TEST_URL + '?allownoref=true',
options: {
stdout: true,
stderr: true,
failOnError: true,
execOptions: {
maxBuffer: Infinity
}
}
},
'compare-slimerjs': {
command: './test/run-slimerjs-compare.sh ' +
TEST_URL + ' ' + BASE_COMMIT,
options: {
stdout: true,
stderr: true,
failOnError: true,
execOptions: {
maxBuffer: Infinity
}
}
}
},
connect: {
test: {
options: {
port: HTTPD_PORT
}
}
},
jshint: {
options: {
jshintrc: true,
reporterOutput: "" // Workaround jshint/jshint#2922
},
all: ['src/*.js']
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.registerTask('test', ['jshint','test-slimerjs']);
grunt.registerTask('compare', ['compare-slimerjs']);
// Run the test suite with QUnit on SlimerJS
grunt.registerTask('test-slimerjs', ['connect', 'shell:qunit-slimerjs']);
// Run the test suite with QUnit on SlimerJS
grunt.registerTask('compare-slimerjs',
['connect', 'shell:compare-slimerjs']);
grunt.registerTask('travis-ci', function() {
if (process.env.TRAVIS_PULL_REQUEST === 'false') {
// Not working on pull requests -- simply run test job.
grunt.task.run(['test']);
} else {
// Running on pull requests -- check linting, and compare the images with
// the branch to merge.
grunt.task.run(['jshint', 'compare']);
}
});
};