forked from qunitjs/qunit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
grunt.js
83 lines (74 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
81
82
83
/*global config:true, task:true*/
module.exports = function( grunt ) {
grunt.loadNpmTasks( "grunt-git-authors" );
grunt.initConfig({
pkg: '<json:package.json>',
qunit: {
// TODO include 'test/logs.html' as well
qunit: 'test/index.html',
addons: [
'addons/canvas/canvas.html',
'addons/close-enough/close-enough.html',
'addons/composite/composite-demo-test.html'
],
async: 'test/async.html'
},
lint: {
qunit: 'qunit/qunit.js',
addons: 'addons/**.js',
grunt: 'grunt.js',
tests: 'test/**.js'
},
// TODO rmeove this one grunt 0.4 is out, see jquery-ui for other details
jshint: (function() {
function parserc( path ) {
var rc = grunt.file.readJSON( (path || "") + ".jshintrc" ),
settings = {
options: rc,
globals: {}
};
(rc.predef || []).forEach(function( prop ) {
settings.globals[ prop ] = true;
});
delete rc.predef;
return settings;
}
return {
addons: parserc( "addons/" ),
qunit: parserc( "qunit/" ),
tests: parserc( "test/" )
};
})()
});
grunt.registerTask( "build-git", function( sha ) {
function processor( content ) {
var tagline = " - A JavaScript Unit Testing Framework";
return content.replace( tagline, "-" + sha + " " + grunt.template.today('isoDate') + tagline );
}
grunt.file.copy( "qunit/qunit.css", "dist/qunit-git.css", {
process: processor
});
grunt.file.copy( "qunit/qunit.js", "dist/qunit-git.js", {
process: processor
});
});
grunt.registerTask( "testswarm", function( commit, configFile ) {
var testswarm = require( "testswarm" ),
config = grunt.file.readJSON( configFile ).qunit;
testswarm({
url: config.swarmUrl,
pollInterval: 10000,
timeout: 1000 * 60 * 30,
done: this.async()
}, {
authUsername: "qunit",
authToken: config.authToken,
jobName: 'QUnit commit #<a href="https://github.com/jquery/qunit/commit/' + commit + '">' + commit.substr( 0, 10 ) + '</a>',
runMax: config.runMax,
"runNames[]": "QUnit",
"runUrls[]": config.testUrl + commit + "/test/index.html",
"browserSets[]": config.browserSets
});
});
grunt.registerTask('default', 'lint qunit');
};