Home page Forum Wiki Mail Jabber Devel NIX-FILES

AltLUG Git

Git-repositories of Altai Linux User Group

Add a test for loading tests asynchronously
[qunit.git] / grunt.js
1 /*global config:true, task:true*/
2 module.exports = function( grunt ) {
3
4 grunt.loadNpmTasks( "grunt-git-authors" );
5
6 grunt.initConfig({
7         pkg: '<json:package.json>',
8         qunit: {
9                 // TODO include 'test/logs.html' as well
10                 qunit: 'test/index.html',
11                 addons: [
12                         'addons/canvas/canvas.html',
13                         'addons/close-enough/close-enough.html',
14                         'addons/composite/composite-demo-test.html'
15                 ],
16                 async: 'test/async.html'
17         },
18         lint: {
19                 qunit: 'qunit/qunit.js',
20                 addons: 'addons/**.js',
21                 grunt: 'grunt.js'
22                 // TODO fix remaining warnings
23                 // tests: 'test/**.js'
24         },
25         // TODO rmeove this one grunt 0.4 is out, see jquery-ui for other details
26         jshint: (function() {
27                 function parserc( path ) {
28                         var rc = grunt.file.readJSON( (path || "") + ".jshintrc" ),
29                                 settings = {
30                                         options: rc,
31                                         globals: {}
32                                 };
33
34                         (rc.predef || []).forEach(function( prop ) {
35                                 settings.globals[ prop ] = true;
36                         });
37                         delete rc.predef;
38
39                         return settings;
40                 }
41
42                 return {
43                         addons: parserc( "addons/" ),
44                         qunit: parserc( "qunit/" ),
45                         tests: parserc( "test/" )
46                 };
47         })()
48 });
49
50 grunt.registerTask( "build-git", function( sha ) {
51         function processor( content ) {
52                 var tagline = " - A JavaScript Unit Testing Framework";
53                 return content.replace( tagline, "-" + sha + " " + grunt.template.today('isoDate') + tagline );
54         }
55         grunt.file.copy( "qunit/qunit.css", "dist/qunit-git.css", {
56                 process: processor
57         });
58         grunt.file.copy( "qunit/qunit.js", "dist/qunit-git.js", {
59                 process: processor
60         });
61 });
62
63 grunt.registerTask( "testswarm", function( commit, configFile ) {
64         var testswarm = require( "testswarm" ),
65                 config = grunt.file.readJSON( configFile ).qunit;
66         testswarm({
67                 url: config.swarmUrl,
68                 pollInterval: 10000,
69                 timeout: 1000 * 60 * 30,
70                 done: this.async()
71         }, {
72                 authUsername: "qunit",
73                 authToken: config.authToken,
74                 jobName: 'QUnit commit #<a href="https://github.com/jquery/qunit/commit/' + commit + '">' + commit.substr( 0, 10 ) + '</a>',
75                 runMax: config.runMax,
76                 "runNames[]": "QUnit",
77                 "runUrls[]": config.testUrl + commit + "/test/index.html",
78                 "browserSets[]": ["popular"]
79         });
80 });
81
82 grunt.registerTask('default', 'lint qunit');
83
84 };

Hosting is provided AltSPAHow to use Git
Please direct any questions on jabber alex.wolf@jabber.ru

Valid HTML 4.0 Transitional Valid CSS!

Designer Alexander Wolf