diff --git a/playground/glob-import/__tests__/glob-import.spec.ts b/playground/glob-import/__tests__/glob-import.spec.ts index 1944ae249b9b04..005edcbef70669 100644 --- a/playground/glob-import/__tests__/glob-import.spec.ts +++ b/playground/glob-import/__tests__/glob-import.spec.ts @@ -311,6 +311,16 @@ test('escapes special chars in globs without mangling user supplied glob suffix' .toEqual(expectedNames) }) +test('escape literal parenthesis in glob pattern', async () => { + // https://github.com/vitejs/vite/issues/22166 + // Backslash-escaped parens must match literal "(" / ")" in both dev and build. + await expect + .poll(async () => + JSON.parse(await page.textContent('.escape-literal-parenthesis')), + ) + .toStrictEqual(['/escape/(parenthesis)/mod/index.js']) +}) + test('subpath imports', async () => { await expect .poll(async () => await page.textContent('.subpath-imports')) diff --git a/playground/glob-import/index.html b/playground/glob-import/index.html index 2c211774e58769..998597aa44a261 100644 --- a/playground/glob-import/index.html +++ b/playground/glob-import/index.html @@ -21,6 +21,8 @@

Escape relative glob


 

Escape alias glob


+

Escape literal parenthesis

+

 

Subpath imports


 

Subpath imports (sub dir)

@@ -150,6 +152,17 @@

Base

document.querySelector('.escape-alias').textContent = alias.sort().join('\n') + +