From: Jérémy Lal Date: Sun, 3 Dec 2023 21:41:14 +0000 (+0100) Subject: test runner output fails on some cwd - fix regexp X-Git-Tag: archive/raspbian/18.19.0+dfsg-6+rpi1^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=5cfa53d312176a411a283f53202fc1e67ebb1909;p=nodejs.git test runner output fails on some cwd - fix regexp 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 --- diff --git a/test/parallel/test-runner-output.mjs b/test/parallel/test-runner-output.mjs index 372ca8f3b..59d4cef33 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().replace(/[\\^$*+?.()|[\]{}]/g, '\\$&')}/?${color}(.*)${color}\\)`, 'g'); function replaceSpecDuration(str) { return str