Build: Allow to specify browser sets to TestSwarm tasks

This will make it easier to e.g. now exclude Edge Legacy when testing against
jQuery 4.x.

Closes gh-1936
This commit is contained in:
Michał Gołębiowski-Owczarek 2020-09-25 09:40:33 +02:00 committed by GitHub
parent dadde722a4
commit 6bf38048f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,13 +47,19 @@ var versions = {
"Widget": "widget/widget.html" "Widget": "widget/widget.html"
}; };
function submit( commit, runs, configFile, extra, done ) { function submit( commit, runs, configFile, browserSets, extra, done ) {
var testName, var testName,
testswarm = require( "testswarm" ), testswarm = require( "testswarm" ),
config = grunt.file.readJSON( configFile ).jqueryui, config = grunt.file.readJSON( configFile ).jqueryui,
browserSets = config.browserSets,
commitUrl = "https://github.com/jquery/jquery-ui/commit/" + commit; commitUrl = "https://github.com/jquery/jquery-ui/commit/" + commit;
browserSets = browserSets || config.browserSets;
if ( browserSets[ 0 ] === "[" ) {
// We got an array, parse it
browserSets = JSON.parse( browserSets );
}
if ( extra ) { if ( extra ) {
extra = " (" + extra + ")"; extra = " (" + extra + ")";
} }
@ -84,23 +90,23 @@ function submit( commit, runs, configFile, extra, done ) {
} ); } );
} }
grunt.registerTask( "testswarm", function( commit, configFile ) { grunt.registerTask( "testswarm", function( commit, configFile, browserSets ) {
var test, var test,
latestTests = {}; latestTests = {};
for ( test in tests ) { for ( test in tests ) {
latestTests[ test ] = tests[ test ] + "?nojshint=true"; latestTests[ test ] = tests[ test ] + "?nojshint=true";
} }
submit( commit, latestTests, configFile, "", this.async() ); submit( commit, latestTests, configFile, browserSets, "", this.async() );
} ); } );
grunt.registerTask( "testswarm-multi-jquery", function( commit, configFile, minor ) { grunt.registerTask( "testswarm-multi-jquery", function( commit, configFile, minor, browserSets ) {
var allTests = {}; var allTests = {};
versions[ minor ].split( " " ).forEach( function( version ) { versions[ minor ].split( " " ).forEach( function( version ) {
for ( var test in tests ) { for ( var test in tests ) {
allTests[ test + "-" + version ] = tests[ test ] + "?nojshint=true&jquery=" + version; allTests[ test + "-" + version ] = tests[ test ] + "?nojshint=true&jquery=" + version;
} }
} ); } );
submit( commit, allTests, configFile, "core " + minor, this.async() ); submit( commit, allTests, configFile, browserSets, "core " + minor, this.async() );
} ); } );
}; };