@@ -9,23 +9,16 @@ describe('nuxt3', () => {
9
9
// Note: this is a hacky solution
10
10
await execa ( 'pnpm' , [ 'build' ] , { cwd : __dirname } )
11
11
12
- const globDir = path . join ( __dirname , '.output' , 'public' , '_nuxt' )
13
-
14
- const cssFiles = await globby ( '*.css' , {
15
- cwd : globDir ,
16
- followSymbolicLinks : true ,
17
- } )
18
-
12
+ const html = path . join ( __dirname , '.output' , 'public' , 'index.html' )
13
+ const htmlStyleBlocks = fs . readFileSync ( html , 'utf-8' ) . match ( / < s t y l e > ( [ \s \S ] * ?) < \/ s t y l e > / g)
19
14
let foundAttributify = false
20
- cssFiles
21
- . map ( f => fs . readFileSync ( path . join ( globDir , f ) , 'utf-8' ) )
22
- . forEach ( ( css ) => {
23
- if ( ! foundAttributify && css . includes ( '[bg~=' ) )
24
- foundAttributify = true
25
- // importing scss @apply transforms is broken
26
- if ( ! css . includes ( '.test-apply' ) )
27
- expect ( css ) . not . toContain ( '@apply' )
28
- } )
15
+ htmlStyleBlocks . forEach ( ( css ) => {
16
+ if ( ! foundAttributify && css . includes ( '[bg~=' ) )
17
+ foundAttributify = true
18
+ // importing scss @apply transforms is broken
19
+ if ( ! css . includes ( '.test-apply' ) )
20
+ expect ( css ) . not . toContain ( '@apply' )
21
+ } )
29
22
expect ( foundAttributify ) . toBeTruthy ( )
30
23
} )
31
24
} )
0 commit comments