Skip to content

Commit 3287553

Browse files
cjihrigaduh95
authored andcommitted
test_runner: don't exceed call stack when filtering
This commit updates filteredRun() to call postRun() after a microtask instead of synchronously. Currently, if approximately 1,545 subtests are filtered, enough synchronous calls can be made to cause a call stack exceeded exception. PR-URL: #52488 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
1 parent b4ccb6c commit 3287553

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/internal/test_runner/test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const {
2929
} = primordials;
3030
const { getCallerLocation } = internalBinding('util');
3131
const { addAbortListener } = require('internal/events/abort_listener');
32+
const { queueMicrotask } = require('internal/process/task_queues');
3233
const { AsyncResource } = require('async_hooks');
3334
const { AbortController } = require('internal/abort_controller');
3435
const {
@@ -673,7 +674,7 @@ class Test extends AsyncResource {
673674
this.pass();
674675
this.subtests = [];
675676
this.report = noop;
676-
this.postRun();
677+
queueMicrotask(() => this.postRun());
677678
}
678679

679680
async run() {

0 commit comments

Comments
 (0)