From 4d632c9ced9ae597699b9679f8446835cb01b21a Mon Sep 17 00:00:00 2001 From: Sergey Chernyshev Date: Thu, 25 Apr 2024 01:55:09 +0200 Subject: [PATCH] test: fix snapshot tests when cwd contains spaces or Both are valid characters for file names on non-Windows systems. PR-URL: https://github.com/nodejs/node/pull/48959 Backport-PR-URL: https://github.com/nodejs/node/pull/50669 Reviewed-By: Moshe Atlow Reviewed-By: Luigi Pinca --- graal-nodejs/test/common/assertSnapshot.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/graal-nodejs/test/common/assertSnapshot.js b/graal-nodejs/test/common/assertSnapshot.js index c403751ac3e..10a5941b41f 100644 --- a/graal-nodejs/test/common/assertSnapshot.js +++ b/graal-nodejs/test/common/assertSnapshot.js @@ -5,7 +5,7 @@ const test = require('node:test'); const fs = require('node:fs/promises'); const assert = require('node:assert/strict'); -const stackFramesRegexp = /(\s+)((.+?)\s+\()?(?:\(?(.+?):(\d+)(?::(\d+))?)\)?(\s+\{)?(\[\d+m)?(\n|$)/g; +const stackFramesRegexp = /(?<=\n)(\s+)((.+?)\s+\()?(?:\(?(.+?):(\d+)(?::(\d+))?)\)?(\s+\{)?(\[\d+m)?(\n|$)/g; const windowNewlineRegexp = /\r/g; function replaceStackTrace(str, replacement = '$1*$7$8\n') { @@ -17,7 +17,7 @@ function replaceWindowsLineEndings(str) { } function replaceWindowsPaths(str) { - return str.replaceAll(path.win32.sep, path.posix.sep); + return common.isWindows ? str.replaceAll(path.win32.sep, path.posix.sep) : str; } function transform(...args) {