test runner output fails on some cwd - fix regexp
authorJérémy Lal <kapouer@melix.org>
Sun, 3 Dec 2023 21:41:14 +0000 (22:41 +0100)
committerJérémy Lal <kapouer@melix.org>
Sun, 3 Dec 2023 21:41:14 +0000 (22:41 +0100)
Last-Update: 2023-11-30
Forwarded: https://github.com/nodejs/node/pull/50980

Gbp-Pq: Topic build
Gbp-Pq: Name test_runner_escape_path.patch

test/parallel/test-runner-output.mjs

index 372ca8f3bae0ff6413be7b20e258a9336b2b4317..59d4cef33afc0b0d465fbd25b1a62373059a191a 100644 (file)
@@ -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().replace(/[\\^$*+?.()|[\]{}]/g, '\\$&')}/?${color}(.*)${color}\\)`, 'g');
 
 function replaceSpecDuration(str) {
   return str