2 module.exports = function( grunt ) {
5 To test these tasks locally, create a testswarm-local.json file like this, replacing the token and urls:
9 "authUsername": "jquerymobile",
10 "authToken": "1489f0baccc7af70b15d4bee6b0498f66b1ef611",
11 "swarmUrl": "http://swarm.local/",
12 "testUrl": "http://localhost/",
19 grunt config:test:pages testswarm:jquery-mobile:testswarm-local.json
21 Adapt the second flag, the 'commit', to match files along with the testUrl property.
24 function submit( commit, tests, configFile, done ) {
26 testswarm = require( "testswarm" ),
27 config = grunt.file.readJSON( configFile ).jquerymobile,
28 testBase = config.testUrl + commit + "/",
30 for ( test in tests ) {
31 testUrls.push( testBase + tests[ test ] );
36 timeout: 1000 * 60 * 30,
39 authUsername: config.authUsername,
40 authToken: config.authToken,
41 jobName: 'jQuery Mobile commit #<a href="https://github.com/jquery/jquery-mobile/commit/' + commit + '">' + commit.substr( 0, 10 ) + '</a>',
42 runMax: config.runMax,
43 "runNames[]": Object.keys(tests),
44 "runUrls[]": testUrls,
45 "browserSets[]": ["mobile"]
49 grunt.registerTask( "testswarm", function( commit, configFile ) {
50 // TODO currently using only the first five somewhat stable testsuites
51 // need to expand this
52 var tests = grunt.config.get('global').test_paths, finalSet = [];
54 // exclude the base tests for now, they don't appear to play nicely with testswarm
55 tests.forEach(function( testPath ) {
56 if( ! /base\-tests/.test( testPath ) ){
57 finalSet.push( testPath );
65 for ( var i = 0; i < tests.length; i++ ) {
66 latestTests[ tests[ i ].replace(/^tests\/unit\//, "") ] = tests[ i ];
68 submit( commit, latestTests, configFile, this.async() );