aboutsummaryrefslogtreecommitdiffstats
path: root/Gruntfile.js
diff options
context:
space:
mode:
Diffstat (limited to 'Gruntfile.js')
-rw-r--r--Gruntfile.js35
1 files changed, 20 insertions, 15 deletions
diff --git a/Gruntfile.js b/Gruntfile.js
index 3a56cb4e4..f24e8a448 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -2,8 +2,8 @@
module.exports = function( grunt ) {
function readOptionalJSON( filepath ) {
- var stripJSONComments = require( "strip-json-comments" ),
- data = {};
+ const stripJSONComments = require( "strip-json-comments" );
+ let data = {};
try {
data = JSON.parse( stripJSONComments(
fs.readFileSync( filepath, { encoding: "utf8" } )
@@ -12,19 +12,23 @@ module.exports = function( grunt ) {
return data;
}
- // Support: Node.js <12
- // Skip running tasks that dropped support for Node.js 10
+ const fs = require( "fs" );
+ const gzip = require( "gzip-js" );
+ const nodeV14OrNewer = !/^v1[0-3]\./.test( process.version );
+ const nodeV17OrNewer = !/^v1[0-6]\./.test( process.version );
+ const customBrowsers = process.env.BROWSERS && process.env.BROWSERS.split( "," );
+
+ // Support: Node.js <14
+ // Skip running tasks that dropped support for Node.js 10 or 12
// in this Node version.
function runIfNewNode( task ) {
- return oldNode ? "print_old_node_message:" + task : task;
+ return nodeV14OrNewer ? task : "print_old_node_message:" + task;
}
- var fs = require( "fs" ),
- gzip = require( "gzip-js" ),
- oldNode = /^v10\./.test( process.version ),
- nodeV17OrNewer = !/^v1[0246]\./.test( process.version ),
- isCi = process.env.GITHUB_ACTION,
- ciBrowsers = process.env.BROWSERS && process.env.BROWSERS.split( "," );
+ if ( nodeV14OrNewer ) {
+ const playwright = require( "playwright-webkit" );
+ process.env.WEBKIT_HEADLESS_BIN = playwright.webkit.executablePath();
+ }
if ( !grunt.option( "filename" ) ) {
grunt.option( "filename", "jquery.js" );
@@ -242,10 +246,11 @@ module.exports = function( grunt ) {
singleRun: true
},
main: {
- browsers: isCi && ciBrowsers || [ "ChromeHeadless", "FirefoxHeadless" ]
+ browsers: customBrowsers ||
+ [ "ChromeHeadless", "FirefoxHeadless", "WebkitHeadless" ]
},
esmodules: {
- browsers: isCi && ciBrowsers || [ "ChromeHeadless" ],
+ browsers: customBrowsers || [ "ChromeHeadless" ],
options: {
client: {
qunit: {
@@ -260,7 +265,7 @@ module.exports = function( grunt ) {
}
},
amd: {
- browsers: isCi && ciBrowsers || [ "ChromeHeadless" ],
+ browsers: customBrowsers || [ "ChromeHeadless" ],
options: {
client: {
qunit: {
@@ -352,7 +357,7 @@ module.exports = function( grunt ) {
// Load grunt tasks from NPM packages
require( "load-grunt-tasks" )( grunt, {
- pattern: oldNode ? [ "grunt-*", "!grunt-eslint" ] : [ "grunt-*" ]
+ pattern: nodeV14OrNewer ? [ "grunt-*" ] : [ "grunt-*", "!grunt-eslint" ]
} );
// Integrate jQuery specific tasks