From 5538cfc1e85cf573ffde4bb887c417a87a535ccf Mon Sep 17 00:00:00 2001 From: Chengzhong Wu Date: Sat, 4 Oct 2025 01:39:09 +0200 Subject: [PATCH] test: replace diagnostics_channel stackframe in output snapshots PR-URL: https://github.com/nodejs/node/pull/60024 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- test/common/assertSnapshot.js | 4 +++- .../source-map/output/source_map_assert_source_line.snapshot | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/common/assertSnapshot.js b/test/common/assertSnapshot.js index 7ce70b8c31d..16509f12ee8 100644 --- a/test/common/assertSnapshot.js +++ b/test/common/assertSnapshot.js @@ -17,7 +17,9 @@ function replaceStackTrace(str, replacement = '$1*$7$8\n') { } function replaceInternalStackTrace(str) { - return str.replaceAll(/(\W+).*node:internal.*/g, '$1*'); + // Replace non-internal frame `at TracingChannel.traceSync (node:diagnostics_channel:328:14)` + // as well as `at node:internal/main/run_main_module:33:47` with `*`. + return str.replaceAll(/(\W+).*[(\s]node:.*/g, '$1*'); } function replaceWindowsLineEndings(str) { diff --git a/test/fixtures/source-map/output/source_map_assert_source_line.snapshot b/test/fixtures/source-map/output/source_map_assert_source_line.snapshot index 9def6eb4d7b..62e611f330f 100644 --- a/test/fixtures/source-map/output/source_map_assert_source_line.snapshot +++ b/test/fixtures/source-map/output/source_map_assert_source_line.snapshot @@ -7,7 +7,7 @@ AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value: * * * - at TracingChannel.traceSync (node:diagnostics_channel:328:14) + * * * *