diff --git a/lib/internal/test_runner/runner.js b/lib/internal/test_runner/runner.js index 4a19e13d9a029c..67bd417b88e806 100644 --- a/lib/internal/test_runner/runner.js +++ b/lib/internal/test_runner/runner.js @@ -10,6 +10,7 @@ const { ArrayPrototypeJoin, ArrayPrototypeMap, ArrayPrototypePush, + ArrayPrototypePushApply, ArrayPrototypeShift, ArrayPrototypeSlice, ArrayPrototypeSome, @@ -149,7 +150,8 @@ function getRunArgs(path, { forceExit, inspectPort, testNamePatterns, testSkipPa } if (path === kIsolatedProcessName) { - ArrayPrototypePush(argv, '--test', ...ArrayPrototypeSlice(process.argv, 1)); + ArrayPrototypePush(argv, '--test'); + ArrayPrototypePushApply(argv, ArrayPrototypeSlice(process.argv, 1)); } else { ArrayPrototypePush(argv, path); } diff --git a/lib/internal/test_runner/test.js b/lib/internal/test_runner/test.js index 4331079f74e95a..5ad22f78068ed1 100644 --- a/lib/internal/test_runner/test.js +++ b/lib/internal/test_runner/test.js @@ -8,6 +8,7 @@ const { ArrayPrototypeSome, ArrayPrototypeSplice, ArrayPrototypeUnshift, + ArrayPrototypeUnshiftApply, FunctionPrototype, MathMax, Number, @@ -732,9 +733,9 @@ class Test extends AsyncResource { computeInheritedHooks() { if (this.parent.hooks.beforeEach.length > 0) { - ArrayPrototypeUnshift( + ArrayPrototypeUnshiftApply( this.hooks.beforeEach, - ...ArrayPrototypeSlice(this.parent.hooks.beforeEach), + ArrayPrototypeSlice(this.parent.hooks.beforeEach), ); }