From 781647b1820206e95e5c32be2dffb20e9096b1e4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?= Date: Wed, 20 Sep 2017 15:32:35 +0200 Subject: [PATCH] Build: Drop cross-spawn, use child_process.spawn shell option --- build/tasks/lib/spawn_test.js | 10 +++--- build/tasks/node_smoke_tests.js | 2 +- build/tasks/promises_aplus_tests.js | 8 ++--- package-lock.json | 48 ----------------------------- package.json | 1 - 5 files changed, 11 insertions(+), 58 deletions(-) diff --git a/build/tasks/lib/spawn_test.js b/build/tasks/lib/spawn_test.js index 34353a783..146155411 100644 --- a/build/tasks/lib/spawn_test.js +++ b/build/tasks/lib/spawn_test.js @@ -3,11 +3,13 @@ // Run Node with provided parameters: the first one being the Grunt // done function and latter ones being files to be tested. // See the comment in ../node_smoke_tests.js for more information. -module.exports = function spawnTest( done ) { - var testPaths = [].slice.call( arguments, 1 ), - spawn = require( "cross-spawn" ); +module.exports = function spawnTest( done, command ) { + var spawn = require( "child_process" ).spawn; - spawn( "node", testPaths, { stdio: "inherit" } ) + spawn( command, { + stdio: "inherit", + shell: true + } ) .on( "close", function( code ) { done( code === 0 ); } ); diff --git a/build/tasks/node_smoke_tests.js b/build/tasks/node_smoke_tests.js index 1b860b140..157aa80af 100644 --- a/build/tasks/node_smoke_tests.js +++ b/build/tasks/node_smoke_tests.js @@ -22,7 +22,7 @@ module.exports = function( grunt ) { var taskName = "node_" + testFilePath.replace( /\.js$/, "" ); grunt.registerTask( taskName, function() { - spawnTest( this.async(), "test/node_smoke_tests/" + testFilePath ); + spawnTest( this.async(), "node test/node_smoke_tests/" + testFilePath ); } ); nodeSmokeTests.push( taskName ); diff --git a/build/tasks/promises_aplus_tests.js b/build/tasks/promises_aplus_tests.js index a0118d1f0..c634da5f7 100644 --- a/build/tasks/promises_aplus_tests.js +++ b/build/tasks/promises_aplus_tests.js @@ -9,15 +9,15 @@ module.exports = function( grunt ) { grunt.registerTask( "promises_aplus_tests:deferred", function() { spawnTest( this.async(), - "./node_modules/.bin/promises-aplus-tests", - "test/promises_aplus_adapters/deferred.js" + __dirname + "/../../node_modules/.bin/promises-aplus-tests" + + " test/promises_aplus_adapters/deferred.js" ); } ); grunt.registerTask( "promises_aplus_tests:when", function() { spawnTest( this.async(), - "./node_modules/.bin/promises-aplus-tests", - "test/promises_aplus_adapters/when.js" + __dirname + "/../../node_modules/.bin/promises-aplus-tests" + + " test/promises_aplus_adapters/when.js" ); } ); }; diff --git a/package-lock.json b/package-lock.json index d9fcc215b..135ed3c38 100644 --- a/package-lock.json +++ b/package-lock.json @@ -986,17 +986,6 @@ "integrity": "sha1-etIg1v/c0Rn5/BJ6d3LKzqOQpLo=", "dev": true }, - "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", - "dev": true, - "requires": { - "lru-cache": "4.1.1", - "shebang-command": "1.2.0", - "which": "1.2.14" - } - }, "cryptiles": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", @@ -3998,16 +3987,6 @@ "signal-exit": "3.0.2" } }, - "lru-cache": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", - "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", - "dev": true, - "requires": { - "pseudomap": "1.0.2", - "yallist": "2.1.2" - } - }, "map-obj": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", @@ -4657,12 +4636,6 @@ } } }, - "pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", - "dev": true - }, "punycode": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", @@ -5075,21 +5048,6 @@ "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", "dev": true }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dev": true, - "requires": { - "shebang-regex": "1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true - }, "sigmund": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", @@ -5661,12 +5619,6 @@ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", "dev": true - }, - "yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", - "dev": true } } } diff --git a/package.json b/package.json index 880662b24..f273608b8 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,6 @@ "babel-plugin-transform-es2015-for-of": "7.0.0-beta.0", "commitplease": "2.7.10", "core-js": "2.4.1", - "cross-spawn": "5.1.0", "eslint-config-jquery": "1.0.1", "grunt": "1.0.1", "grunt-babel": "7.0.0", -- 2.39.5