Skip to content

Commit 103b843

Browse files
authored
test_runner: avoid spread operator on arrays
PR-URL: #55143 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 56c1786 commit 103b843

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/internal/test_runner/runner.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ function getRunArgs(path, { forceExit,
158158
ArrayPrototypePushApply(argv, execArgv);
159159

160160
if (path === kIsolatedProcessName) {
161-
ArrayPrototypePush(argv, '--test', ...ArrayPrototypeSlice(process.argv, 1));
161+
ArrayPrototypePush(argv, '--test');
162+
ArrayPrototypePushApply(argv, ArrayPrototypeSlice(process.argv, 1));
162163
} else {
163164
ArrayPrototypePush(argv, path);
164165
}

lib/internal/test_runner/test.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const {
88
ArrayPrototypeSome,
99
ArrayPrototypeSplice,
1010
ArrayPrototypeUnshift,
11+
ArrayPrototypeUnshiftApply,
1112
FunctionPrototype,
1213
MathMax,
1314
Number,
@@ -735,9 +736,9 @@ class Test extends AsyncResource {
735736

736737
computeInheritedHooks() {
737738
if (this.parent.hooks.beforeEach.length > 0) {
738-
ArrayPrototypeUnshift(
739+
ArrayPrototypeUnshiftApply(
739740
this.hooks.beforeEach,
740-
...ArrayPrototypeSlice(this.parent.hooks.beforeEach),
741+
ArrayPrototypeSlice(this.parent.hooks.beforeEach),
741742
);
742743
}
743744

0 commit comments

Comments
 (0)