diff --git a/lib/internal/test_runner/runner.js b/lib/internal/test_runner/runner.js index b8d7740614cee5..2241df6b378253 100644 --- a/lib/internal/test_runner/runner.js +++ b/lib/internal/test_runner/runner.js @@ -158,7 +158,8 @@ function getRunArgs(path, { forceExit, ArrayPrototypePushApply(argv, execArgv); 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 993c98802abde4..0bc24bae54496a 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, @@ -735,9 +736,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), ); }