Skip to content

Commit 4ddd0da

Browse files
kapoueraduh95
authored andcommitted
test: escape cwd in regexp
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #50980 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 95d8a27 commit 4ddd0da

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/parallel/test-runner-output.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function replaceTestDuration(str) {
1515
}
1616

1717
const color = '(\\[\\d+m)';
18-
const stackTraceBasePath = new RegExp(`${color}\\(${process.cwd()}/?${color}(.*)${color}\\)`, 'g');
18+
const stackTraceBasePath = new RegExp(`${color}\\(${process.cwd().replaceAll(/[\\^$*+?.()|[\]{}]/g, '\\$&')}/?${color}(.*)${color}\\)`, 'g');
1919

2020
function replaceSpecDuration(str) {
2121
return str

0 commit comments

Comments
 (0)