From 412d7dfe1d69e76a8febb4e5b585a3d5b2e2022d Mon Sep 17 00:00:00 2001 From: Chengzhong Wu Date: Fri, 26 Sep 2025 14:07:01 +0100 Subject: [PATCH] test: replace diagnostics_channel stackframe in output snapshots --- 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 7ce70b8c31d3aa..16509f12ee89fc 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 9def6eb4d7bedb..62e611f330f97f 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) + * * * *