diff --git a/packages/utils/src/source-map.ts b/packages/utils/src/source-map.ts index 69899cc00d06..7539ac09d0f0 100644 --- a/packages/utils/src/source-map.ts +++ b/packages/utils/src/source-map.ts @@ -23,7 +23,7 @@ function extractLocation(urlLike: string) { return [urlLike] const regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/ - const parts = regExp.exec(urlLike.replace(/[()]/g, '')) + const parts = regExp.exec(urlLike.replace(/^\(|\)$/g, '')) if (!parts) return [urlLike] return [parts[1], parts[2] || undefined, parts[3] || undefined] diff --git a/test/core/test/snapshot-inline-(parentheses).test.ts b/test/core/test/snapshot-inline-(parentheses).test.ts new file mode 100644 index 000000000000..5cf443ebfc41 --- /dev/null +++ b/test/core/test/snapshot-inline-(parentheses).test.ts @@ -0,0 +1,18 @@ +import { expect, test } from 'vitest' + +test('object', () => { + expect({ + foo: { + type: 'object', + map: new Map(), + }, + }) + .toMatchInlineSnapshot(` + { + "foo": { + "map": Map {}, + "type": "object", + }, + } + `) +})