Core: Use named exports in `src/`
[jquery.git] / build / tasks / testswarm.js
blobd2653e0e057d2fab5247145db029275fd87d0c5a
1 "use strict";
3 module.exports = function( grunt ) {
4 grunt.registerTask( "testswarm", function( commit, configFile, projectName, browserSets,
5 timeout, testMode ) {
6 var jobName, config, tests,
7 testswarm = require( "testswarm" ),
8 runs = {},
9 done = this.async(),
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" ] );
23 if ( pull ) {
24 jobName = "Pull <a href='https://github.com/jquery/jquery/pull/" +
25 pull[ 1 ] + "'>#" + pull[ 1 ] + "</a>";
26 } else {
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";
33 } else {
34 tests.forEach( function( test ) {
35 runs[ test ] = config.testUrl + commit + "/test/index.html?module=" + test;
36 } );
39 testswarm.createClient( {
40 url: config.swarmUrl
41 } )
42 .addReporter( testswarm.reporters.cli )
43 .auth( {
44 id: config.authUsername,
45 token: config.authToken
46 } )
47 .addjob(
49 name: jobName,
50 runs: runs,
51 runMax: config.runMax,
52 browserSets: browserSets,
53 timeout: timeout
54 }, function( err, passed ) {
55 if ( err ) {
56 grunt.log.error( err );
58 done( passed );
61 } );