From fba2c9332f4bccc2b0b300de234d413ae28b4b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lal?= Date: Tue, 5 Dec 2023 01:17:48 +0100 Subject: [PATCH] test: escape cwd in regexp Co-authored-by: Antoine du Hamel PR-URL: https://github.com/nodejs/node/pull/50980 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Luigi Pinca Reviewed-By: Chemi Atlow Reviewed-By: Moshe Atlow Reviewed-By: Antoine du Hamel --- test/parallel/test-runner-output.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-runner-output.mjs b/test/parallel/test-runner-output.mjs index 0e41ff101b843f..e40ce896bff465 100644 --- a/test/parallel/test-runner-output.mjs +++ b/test/parallel/test-runner-output.mjs @@ -15,7 +15,7 @@ function replaceTestDuration(str) { } const color = '(\\[\\d+m)'; -const stackTraceBasePath = new RegExp(`${color}\\(${process.cwd()}/?${color}(.*)${color}\\)`, 'g'); +const stackTraceBasePath = new RegExp(`${color}\\(${process.cwd().replaceAll(/[\\^$*+?.()|[\]{}]/g, '\\$&')}/?${color}(.*)${color}\\)`, 'g'); function replaceSpecDuration(str) { return str