3 module.exports = function( grunt ) {
4 grunt.registerTask( "testswarm", function( commit, configFile, projectName, browserSets,
6 var jobName, config, tests,
7 testswarm = require( "testswarm" ),
10 pull = /PR-(\d+)/.exec( commit );
12 projectName = projectName || "jquery";
13 config = grunt.file.readJSON( configFile )[ projectName ];
14 browserSets = browserSets || config.browserSets;
15 if ( browserSets[ 0 ] === "[" ) {
17 // We got an array, parse it
18 browserSets = JSON.parse( browserSets );
20 timeout = timeout || 1000 * 60 * 15;
21 tests = grunt.config( [ this.name, "tests" ] );
24 jobName = "Pull <a href='https://github.com/jquery/jquery/pull/" +
25 pull[ 1 ] + "'>#" + pull[ 1 ] + "</a>";
27 jobName = "Commit <a href='https://github.com/jquery/jquery/commit/" +
28 commit + "'>" + commit.substr( 0, 10 ) + "</a>";
31 if ( testMode === "basic" ) {
32 runs.basic = config.testUrl + commit + "/test/index.html?module=basic";
34 tests.forEach( function( test ) {
35 runs[ test ] = config.testUrl + commit + "/test/index.html?module=" + test;
39 testswarm.createClient( {
42 .addReporter( testswarm.reporters.cli )
44 id: config.authUsername,
45 token: config.authToken
51 runMax: config.runMax,
52 browserSets: browserSets,
54 }, function( err, passed ) {
56 grunt.log.error( err );