Skip to content

Commit

Permalink
test_runner: avoid spread operator on arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Sep 27, 2024
1 parent fbc6fcb commit 979af26
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/internal/test_runner/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const {
ArrayPrototypeJoin,
ArrayPrototypeMap,
ArrayPrototypePush,
ArrayPrototypePushApply,
ArrayPrototypeShift,
ArrayPrototypeSlice,
ArrayPrototypeSome,
Expand Down Expand Up @@ -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);
}
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 @@ -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),
);
}

Expand Down

0 comments on commit 979af26

Please sign in to comment.