Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Grunt: Add testswarm task, for now with a small subset of somewhat st…

…able testsuites, as a starting point
  • Loading branch information...
commit 788e3b27165c4f0abe6c50329625ca85704e523c 1 parent e3c173e
Jörn Zaefferer jzaefferer authored
Showing with 63 additions and 1 deletion.
  1. +61 −0 build/tasks/testswarm.js
  2. +2 −1  package.json
61 build/tasks/testswarm.js
View
@@ -0,0 +1,61 @@
+/*jshint node: true */
+module.exports = function( grunt ) {
+
+/*
+To test these tasks locally, create a testswarm-local.json file like this, replacing the token and urls:
+
+{
+ "jquerymobile": {
+ "authUsername": "jquerymobile",
+ "authToken": "1489f0baccc7af70b15d4bee6b0498f66b1ef611",
+ "swarmUrl": "http://swarm.local/",
+ "testUrl": "http://localhost/",
+ "runMax": 1
+ }
+}
+
+Then call:
+
+ grunt config:test:pages testswarm:jquery-mobile/:testswarm-local.json
+
+Adapt the second flag, the 'commit', to match files along with the testUrl property.
+ */
+
+function submit( commit, tests, configFile, done ) {
+ var test,
+ testswarm = require( "testswarm" ),
+ config = grunt.file.readJSON( configFile ).jquerymobile,
+ testBase = config.testUrl + commit,
+ testUrls = [];
+ for ( test in tests ) {
+ testUrls.push( testBase + tests[ test ] );
+ }
+ testswarm({
+ url: config.swarmUrl,
+ pollInterval: 10000,
+ timeout: 1000 * 60 * 30,
+ done: done
+ }, {
+ authUsername: config.authUsername,
+ authToken: config.authToken,
+ jobName: 'jQuery Mobile commit #<a href="https://github.com/jquery/jquery-mobile/commit/' + commit + '">' + commit.substr( 0, 10 ) + '</a>',
+ runMax: config.runMax,
+ "runNames[]": Object.keys(tests),
+ "runUrls[]": testUrls,
+ "browserSets[]": ["mobile"]
+ });
+}
+
+grunt.registerTask( "testswarm", function( commit, configFile ) {
+ // TODO currently using only the first five somewhat stable testsuites
+ // need to expand this
+ var tests = grunt.config.get('global').test_paths.slice( 0, 5 );
+ var test,
+ latestTests = {};
+ for ( var i = 0; i < tests.length; i++ ) {
+ latestTests[ tests[ i ].replace(/^tests\/unit\//, "") ] = tests[ i ];
+ }
+ submit( commit, latestTests, configFile, this.async() );
+});
+
+};
3  package.json
View
@@ -16,7 +16,8 @@
"grunt-junit": "0.1.4",
"requirejs": "1.0.8",
"glob-whatev": "~0.1.4",
- "rimraf": "2.0.1"
+ "rimraf": "2.0.1",
+ "testswarm": "0.2.3"
},
"engine": {
"node": ">=6.0"
Please sign in to comment.
Something went wrong with that request. Please try again.