From 9cb124ed00aad8ac47690e31ad0bb8c3c365663d Mon Sep 17 00:00:00 2001 From: Michał Gołębiowski-Owczarek Date: Mon, 4 Mar 2019 18:30:51 +0100 Subject: Build: Update jsdom; migrate a test with Symbol polyfill to an iframe test So far, we've been testing that jQuery element iteration works with polyfilled Symbol & transpiled for-of via a Node test with jsdom with the Symbol global removed. Unfortunately, jsdom now requires Symbol to be present for its internal functionality so such a test is no longer possible. Instead, it's been migrated to an iframe test with transpiled JavaScript. This PR also enables us to use ECMAScript 2017 or newer in Node.js code. Closes gh-4305 --- build/tasks/node_smoke_tests.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'build') diff --git a/build/tasks/node_smoke_tests.js b/build/tasks/node_smoke_tests.js index bd0a9150e..e3d69db88 100644 --- a/build/tasks/node_smoke_tests.js +++ b/build/tasks/node_smoke_tests.js @@ -1,11 +1,11 @@ -module.exports = function( grunt ) { +module.exports = ( grunt ) => { "use strict"; - var fs = require( "fs" ), - spawnTest = require( "./lib/spawn_test.js" ), - testsDir = "./test/node_smoke_tests/", - nodeSmokeTests = [ "babel:nodeSmokeTests" ]; + const fs = require( "fs" ); + const spawnTest = require( "./lib/spawn_test.js" ); + const testsDir = "./test/node_smoke_tests/"; + const nodeSmokeTests = [ "babel:nodeSmokeTests" ]; // Fire up all tests defined in test/node_smoke_tests/*.js in spawned sub-processes. // All the files under test/node_smoke_tests/*.js are supposed to exit with 0 code @@ -14,15 +14,15 @@ module.exports = function( grunt ) { // each other, e.g. so that they don't share the require cache. fs.readdirSync( testsDir ) - .filter( function( testFilePath ) { - return fs.statSync( testsDir + testFilePath ).isFile() && - /\.js$/.test( testFilePath ); - } ) - .forEach( function( testFilePath ) { - var taskName = "node_" + testFilePath.replace( /\.js$/, "" ); + .filter( ( testFilePath ) => + fs.statSync( testsDir + testFilePath ).isFile() && + /\.js$/.test( testFilePath ) + ) + .forEach( ( testFilePath ) => { + const taskName = `node_${ testFilePath.replace( /\.js$/, "" ) }`; grunt.registerTask( taskName, function() { - spawnTest( this.async(), "node \"test/node_smoke_tests/" + testFilePath + "\"" ); + spawnTest( this.async(), `node "test/node_smoke_tests/${ testFilePath }"` ); } ); nodeSmokeTests.push( taskName ); -- cgit v1.2.3