Skip to content

Commit 684c3b3

Browse files
authored
test: capture stack trace in debugger timeout errors
Otherwise when the expected prompt does not show up in the session and the debugger tests time out, there is not enough information to figure out exactly which line in the test is causing the timeout. PR-URL: #60457 Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent fbef1cf commit 684c3b3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/common/debugger.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@ function startCLI(args, flags = [], spawnOpts = {}, opts = { randomPort: true })
8888
reject(new Error(message));
8989
}
9090

91+
// Capture stack trace here to show where waitFor was called from when it times out.
92+
const timeoutErr = new Error(`Timeout (${TIMEOUT}) while waiting for ${pattern}`);
9193
const timer = setTimeout(() => {
9294
tearDown();
93-
reject(new Error([
94-
`Timeout (${TIMEOUT}) while waiting for ${pattern}`,
95-
`found: ${this.output}`,
96-
].join('; ')));
95+
timeoutErr.output = this.output;
96+
reject(timeoutErr);
9797
}, TIMEOUT);
9898

9999
function tearDown() {

0 commit comments

Comments
 (0)