test_runner: avoid spread operator on arrays

PR-URL: https://github.com/nodejs/node/pull/55143
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Antoine du Hamel
2024-09-29 17:22:10 +02:00
committed by GitHub
parent 56c1786475
commit 103b8439ca
2 changed files with 5 additions and 3 deletions

View File

@@ -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);
}

View File

@@ -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),
);
}