]> source.dussan.org Git - jquery.git/commitdiff
Build: Test on Node 17, update Grunt & `karma-*` packages
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>
Mon, 14 Mar 2022 16:58:41 +0000 (17:58 +0100)
committerGitHub <noreply@github.com>
Mon, 14 Mar 2022 16:58:41 +0000 (17:58 +0100)
This adds testing on Node.js 17 in addition to the currently tested 10, 12, 14
and 16 versions.

Also, update Grunt & `karma-*` packages.

Testing in Karma on jsdom is broken in Node 17 at the moment; until we find
a fix, this change disables such testing on Node 17 or newer.

Node smoke tests & promises aplus tests are disabled on Node.js 10 as they
depend on jsdom and the latest jsdom version doesn't run properly on Node 10.

Closes gh-5023

.github/workflows/node.js.yml
Gruntfile.js
package.json

index 0b4e6950f03664ec446d68111d96e83b7d77e3c9..5c011b426b686a6fef95f6a1b970eb32cd0de26b 100644 (file)
@@ -9,7 +9,8 @@ jobs:
       fail-fast: false
       matrix:
         # Node.js 10 is required by jQuery infra
-        NODE_VERSION: [10.x, 12.x, 14.x, 16.x]
+        # Do not remove 16.x until jsdom tests are re-enabled on newer Node.js versions.
+        NODE_VERSION: [10.x, 12.x, 14.x, 16.x, 17.x]
         NPM_SCRIPT: ["test:browserless"]
         include:
           - NAME: "Browser tests: full build, Chrome & Firefox stable"
index 7514c9a75e40618397abca8ed0f488fddba60009..687b3215c92928c5ca3714822497b490d264af9f 100644 (file)
@@ -22,6 +22,7 @@ module.exports = function( grunt ) {
        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( "," );
 
@@ -362,6 +363,10 @@ module.exports = function( grunt ) {
                grunt.log.writeln( "Old Node.js detected, running the task \"" + task + "\" skipped..." );
        } );
 
+       grunt.registerTask( "print_jsdom_message", () => {
+               grunt.log.writeln( "Node.js 17 or newer detected, skipping jsdom tests..." );
+       } );
+
        grunt.registerTask( "lint", [
                "jsonlint",
 
@@ -381,10 +386,14 @@ module.exports = function( grunt ) {
                runIfNewNode( "newer:eslint:dist" )
        ] );
 
-       grunt.registerTask( "test:fast", "node_smoke_tests" );
+       grunt.registerTask( "test:fast", runIfNewNode( "node_smoke_tests" ) );
        grunt.registerTask( "test:slow", [
-               "promises_aplus_tests",
-               "karma:jsdom"
+               runIfNewNode( "promises_aplus_tests" ),
+
+               // Support: Node.js 17+
+               // jsdom fails to connect to the Karma server in Node 17+.
+               // Until we figure out a fix, skip jsdom tests there.
+               nodeV17OrNewer ? "print_jsdom_message" : runIfNewNode( "karma:jsdom" )
        ] );
 
        grunt.registerTask( "test:prepare", [
index b58a8be3b6fa631a897c27485f49ab79fa66c9f8..801825089d89697c3f8c39af33a501db9198a2bc 100644 (file)
     "core-js-bundle": "3.6.5",
     "eslint-config-jquery": "3.0.0",
     "eslint-plugin-import": "2.25.2",
-    "grunt": "1.2.1",
+    "grunt": "1.4.1",
     "grunt-babel": "8.0.0",
-    "grunt-cli": "1.3.2",
+    "grunt-cli": "1.4.3",
     "grunt-compare-size": "0.4.2",
     "grunt-contrib-uglify": "3.4.0",
     "grunt-contrib-watch": "1.1.0",
     "grunt-eslint": "24.0.0",
     "grunt-git-authors": "3.2.0",
     "grunt-jsonlint": "2.1.2",
-    "grunt-karma": "4.0.0",
+    "grunt-karma": "4.0.2",
     "grunt-newer": "1.3.0",
     "grunt-npmcopy": "0.2.0",
     "gzip-js": "0.3.2",
     "husky": "4.2.5",
     "insight": "0.10.3",
-    "jsdom": "16.3.0",
-    "karma": "5.1.0",
+    "jsdom": "19.0.0",
+    "karma": "^6.3.17",
     "karma-browserstack-launcher": "1.6.0",
-    "karma-chrome-launcher": "3.1.0",
-    "karma-firefox-launcher": "1.3.0",
+    "karma-chrome-launcher": "3.1.1",
+    "karma-firefox-launcher": "2.1.2",
     "karma-ie-launcher": "1.0.0",
-    "karma-jsdom-launcher": "8.0.2",
-    "karma-qunit": "4.1.1",
+    "karma-jsdom-launcher": "12.0.0",
+    "karma-qunit": "4.1.2",
     "load-grunt-tasks": "5.1.0",
     "native-promise-only": "0.8.1",
     "promises-aplus-tests": "2.1.2",