Commit 76ede1d471a for nodejs
commit 76ede1d471a98f010ffd6ab6913a071bdf4a1715
Author: Antonio Duran <ing.antonio.duran@gmail.com>
Date: Mon Nov 2 10:19:43 2026 -0600
test: use spawnSyncAndAssert in nested async stack overflow test
Signed-off-by: Antonio Duran <ing.antonio.duran@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67123
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
diff --git a/test/parallel/test-async-hooks-stack-overflow-nested-async.js b/test/parallel/test-async-hooks-stack-overflow-nested-async.js
index 779f8d75ae2..faa457e211f 100644
--- a/test/parallel/test-async-hooks-stack-overflow-nested-async.js
+++ b/test/parallel/test-async-hooks-stack-overflow-nested-async.js
@@ -7,7 +7,7 @@
require('../common');
const assert = require('assert');
-const { spawnSync } = require('child_process');
+const { spawnSyncAndAssert } = require('../common/child_process');
if (process.argv[2] === 'child') {
const { createHook } = require('async_hooks');
@@ -64,17 +64,12 @@ if (process.argv[2] === 'child') {
}
} else {
// Parent process - spawn the child and check exit code
- const result = spawnSync(
+ spawnSyncAndAssert(
process.execPath,
[__filename, 'child'],
- { encoding: 'utf8', timeout: 30000 }
+ { encoding: 'utf8', timeout: 30000 },
+ {
+ stdout: /SUCCESS: try-catch caught the stack overflow/,
+ },
);
-
- // Should exit successfully (try-catch worked)
- assert.strictEqual(result.status, 0,
- `Expected exit code 0, got ${result.status}.\n` +
- `stdout: ${result.stdout}\n` +
- `stderr: ${result.stderr}`);
- // Verify the error was handled by try-catch
- assert.match(result.stdout, /SUCCESS: try-catch caught the stack overflow/);
}