Skip to content

Commit 84f748d

Browse files
committed
fix: handle variable arguments correctly in the arrow function
This is a regression introduced by Biome's linting of this file which changed the code to use arrow functions from regular functions. Arrow functions don't have their own arguments object, they inherit it from the enclosing scope instead.
1 parent cbc8bc2 commit 84f748d

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

packages/artillery/lib/console-capture.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ function setupConsoleCapture() {
4040

4141
console.log = (() => {
4242
const orig = console.log;
43-
return () => {
43+
return (...args) => {
4444
try {
45-
orig.apply(console, arguments);
45+
orig.apply(console, args);
4646

4747
if (currentSize < MAX_RETAINED_LOG_SIZE) {
48-
outputLines = outputLines.concat(arguments);
49-
for (const x of arguments) {
48+
outputLines = outputLines.concat(args);
49+
for (const x of args) {
5050
currentSize += String(x).length;
5151
}
5252
} else {
@@ -65,13 +65,13 @@ function setupConsoleCapture() {
6565

6666
console.error = (() => {
6767
const orig = console.error;
68-
return () => {
68+
return (...args) => {
6969
try {
70-
orig.apply(console, arguments);
70+
orig.apply(console, args);
7171

7272
if (currentSize < MAX_RETAINED_LOG_SIZE) {
73-
outputLines = outputLines.concat(arguments);
74-
for (const x of arguments) {
73+
outputLines = outputLines.concat(args);
74+
for (const x of args) {
7575
currentSize += String(x).length;
7676
}
7777
} else {
@@ -89,4 +89,4 @@ function setupConsoleCapture() {
8989
})();
9090
}
9191

92-
module.exports = setupConsoleCapture;
92+
module.exports = setupConsoleCapture;

0 commit comments

Comments
 (0)