Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup! test: unify assertSnapshot stacktrace transform
  • Loading branch information
legendecas committed Feb 10, 2026
commit a6957a119c2c2c7337c91fa3705b43daa504cc8a
12 changes: 6 additions & 6 deletions test/common/assertSnapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ function replaceWindowsLineEndings(str) {
// Replaces all Windows path separators with posix separators for unified snapshots
// across platforms.
function replaceWindowsPaths(str) {
return common.isWindows ? str.replaceAll(path.win32.sep, path.posix.sep) : str;
if (!common.isWindows) {
return str;
}
// Only replace `\` and `\\` with a leading letter, colon, or a `.`.
// Avoid replacing escaping patterns like ` \#`, `\ `, or `\\`.
return str.replaceAll(/(?<=(\w:|\.|\w+)(?:\S|\\ )*)\\\\?/g, '/');
}

// Removes line trailing white spaces.
Expand Down Expand Up @@ -224,10 +229,6 @@ function replaceJunitDuration(str) {
.replaceAll(/file="[^"]*"/g, 'file="*"');
}

function removeWindowsPathEscaping(str) {
return common.isWindows ? str.replaceAll(/\\\\/g, '\\') : str;
}

// The Node test coverage returns results for all files called by the test. This
// will make the output file change if files like test/common/index.js change.
// This transform picks only the first line and then the lines from the test
Expand All @@ -254,7 +255,6 @@ function pickTestFileFromLcov(str) {
const basicTransform = transform(
replaceWindowsLineEndings,
replaceTrailingSpaces,
removeWindowsPathEscaping,
replaceWindowsPaths,
replaceNodeVersion,
generalizeExeName,
Expand Down
Loading