Skip to content

Commit

Permalink
test: escape cwd in regexp
Browse files Browse the repository at this point in the history
Co-authored-by: Antoine du Hamel <[email protected]>
  • Loading branch information
kapouer and aduh95 committed Nov 30, 2023
1 parent b7d2827 commit a0cbf71
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/parallel/test-runner-output.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as fixtures from '../common/fixtures.mjs';
import * as snapshot from '../common/assertSnapshot.js';
import { describe, it } from 'node:test';
import { hostname } from 'node:os';
const { RegExpPrototypeSymbolReplace } = require('internal/test/binding').primordials;

const skipForceColors =
process.config.variables.icu_gyp_path !== 'tools/icu/icu-generic.gyp' ||
Expand All @@ -15,7 +16,7 @@ function replaceTestDuration(str) {
}

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

function replaceSpecDuration(str) {
return str
Expand Down

0 comments on commit a0cbf71

Please sign in to comment.