Skip to content

Commit

Permalink
test_runner: avoid spread operator on arrays
Browse files Browse the repository at this point in the history
PR-URL: #55143
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
aduh95 authored Sep 29, 2024
1 parent 56c1786 commit 103b843
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/internal/test_runner/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
5 changes: 3 additions & 2 deletions lib/internal/test_runner/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const {
ArrayPrototypeSome,
ArrayPrototypeSplice,
ArrayPrototypeUnshift,
ArrayPrototypeUnshiftApply,
FunctionPrototype,
MathMax,
Number,
Expand Down Expand Up @@ -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),
);
}

Expand Down

0 comments on commit 103b843

Please sign in to comment.