Skip to content

Commit dcf1346

Browse files
authoredMay 17, 2023
fix: toMatchInlineSnapshot fails when file path includes parentheses (fix #3370) (#3371)
1 parent c44d991 commit dcf1346

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed
 

‎packages/utils/src/source-map.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function extractLocation(urlLike: string) {
2323
return [urlLike]
2424

2525
const regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/
26-
const parts = regExp.exec(urlLike.replace(/[()]/g, ''))
26+
const parts = regExp.exec(urlLike.replace(/^\(|\)$/g, ''))
2727
if (!parts)
2828
return [urlLike]
2929
return [parts[1], parts[2] || undefined, parts[3] || undefined]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { expect, test } from 'vitest'
2+
3+
test('object', () => {
4+
expect({
5+
foo: {
6+
type: 'object',
7+
map: new Map(),
8+
},
9+
})
10+
.toMatchInlineSnapshot(`
11+
{
12+
"foo": {
13+
"map": Map {},
14+
"type": "object",
15+
},
16+
}
17+
`)
18+
})

0 commit comments

Comments
 (0)
Please sign in to comment.