Skip to content

Commit

Permalink
[test] Escape cwd in regexp
Browse files Browse the repository at this point in the history
Some signs in cwd could make this regexp fail
  • Loading branch information
kapouer authored Nov 30, 2023
1 parent b7d2827 commit 6002e36
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/parallel/test-runner-output.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6002e36

Please sign in to comment.