Skip to content

Commit

Permalink
test_runner: don't exceed call stack when filtering
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
cjihrig authored and aduh95 committed Apr 29, 2024
1 parent b4ccb6c commit 3287553
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/internal/test_runner/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const {
} = primordials;
const { getCallerLocation } = internalBinding('util');
const { addAbortListener } = require('internal/events/abort_listener');
const { queueMicrotask } = require('internal/process/task_queues');
const { AsyncResource } = require('async_hooks');
const { AbortController } = require('internal/abort_controller');
const {
Expand Down Expand Up @@ -673,7 +674,7 @@ class Test extends AsyncResource {
this.pass();
this.subtests = [];
this.report = noop;
this.postRun();
queueMicrotask(() => this.postRun());
}

async run() {
Expand Down

0 comments on commit 3287553

Please sign in to comment.