@@ -88,12 +88,14 @@ const baseRawResult = {
8888}
8989
9090test ( 'should work' , async ( ) => {
91- await expect
92- . poll ( async ( ) => JSON . parse ( await page . textContent ( '.result' ) ) )
93- . toStrictEqual ( allResult )
94- await expect
95- . poll ( async ( ) => JSON . parse ( await page . textContent ( '.result-eager' ) ) )
96- . toStrictEqual ( allResult )
91+ if ( ! process . env . _VITE_TEST_NATIVE_PLUGIN ) {
92+ await expect
93+ . poll ( async ( ) => JSON . parse ( await page . textContent ( '.result' ) ) )
94+ . toStrictEqual ( allResult )
95+ await expect
96+ . poll ( async ( ) => JSON . parse ( await page . textContent ( '.result-eager' ) ) )
97+ . toStrictEqual ( allResult )
98+ }
9799 await expect
98100 . poll ( async ( ) =>
99101 JSON . parse ( await page . textContent ( '.result-node_modules' ) ) ,
@@ -223,29 +225,32 @@ test('tree-shake eager css', async () => {
223225 }
224226} )
225227
226- test ( 'escapes special chars in globs without mangling user supplied glob suffix' , async ( ) => {
227- // the escape dir contains subdirectories where each has a name that needs escaping for glob safety
228- // inside each of them is a glob.js that exports the result of a relative glob `./**/*.js`
229- // and an alias glob `@escape_<dirname>_mod/**/*.js`. The matching aliases are generated in vite.config.ts
230- // index.html has a script that loads all these glob.js files and prints the globs that returned the expected result
231- // this test finally compares the printed output of index.js with the list of directories with special chars,
232- // expecting that they all work
233- const files = await readdir ( path . join ( __dirname , '..' , 'escape' ) , {
234- withFileTypes : true ,
235- } )
236- const expectedNames = files
237- . filter ( ( f ) => f . isDirectory ( ) )
238- . map ( ( f ) => `/escape/${ f . name } /glob.js` )
239- . sort ( )
240- const foundRelativeNames = ( await page . textContent ( '.escape-relative' ) )
241- . split ( '\n' )
242- . sort ( )
243- expect ( expectedNames ) . toEqual ( foundRelativeNames )
244- const foundAliasNames = ( await page . textContent ( '.escape-alias' ) )
245- . split ( '\n' )
246- . sort ( )
247- expect ( expectedNames ) . toEqual ( foundAliasNames )
248- } )
228+ test . skipIf ( ! ! process . env . _VITE_TEST_NATIVE_PLUGIN ) (
229+ 'escapes special chars in globs without mangling user supplied glob suffix' ,
230+ async ( ) => {
231+ // the escape dir contains subdirectories where each has a name that needs escaping for glob safety
232+ // inside each of them is a glob.js that exports the result of a relative glob `./**/*.js`
233+ // and an alias glob `@escape_<dirname>_mod/**/*.js`. The matching aliases are generated in vite.config.ts
234+ // index.html has a script that loads all these glob.js files and prints the globs that returned the expected result
235+ // this test finally compares the printed output of index.js with the list of directories with special chars,
236+ // expecting that they all work
237+ const files = await readdir ( path . join ( __dirname , '..' , 'escape' ) , {
238+ withFileTypes : true ,
239+ } )
240+ const expectedNames = files
241+ . filter ( ( f ) => f . isDirectory ( ) )
242+ . map ( ( f ) => `/escape/${ f . name } /glob.js` )
243+ . sort ( )
244+ const foundRelativeNames = ( await page . textContent ( '.escape-relative' ) )
245+ . split ( '\n' )
246+ . sort ( )
247+ expect ( expectedNames ) . toEqual ( foundRelativeNames )
248+ const foundAliasNames = ( await page . textContent ( '.escape-alias' ) )
249+ . split ( '\n' )
250+ . sort ( )
251+ expect ( expectedNames ) . toEqual ( foundAliasNames )
252+ } ,
253+ )
249254
250255test ( 'subpath imports' , async ( ) => {
251256 expect ( await page . textContent ( '.subpath-imports' ) ) . toMatch ( 'bar foo' )
0 commit comments