Skip to content

Commit

Permalink
chore: fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Jul 3, 2024
1 parent 97c3967 commit e0f1588
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions playground/nuxt3/nuxt3.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,16 @@ describe('nuxt3', () => {
// Note: this is a hacky solution
await execa('pnpm', ['build'], { cwd: __dirname })

const globDir = path.join(__dirname, '.output', 'public', '_nuxt')

const cssFiles = await globby('*.css', {
cwd: globDir,
followSymbolicLinks: true,
})

const html = path.join(__dirname, '.output', 'public', 'index.html')
const htmlStyleBlocks = fs.readFileSync(html, 'utf-8').match(/<style>([\s\S]*?)<\/style>/g)
let foundAttributify = false
cssFiles
.map(f => fs.readFileSync(path.join(globDir, f), 'utf-8'))
.forEach((css) => {
if (!foundAttributify && css.includes('[bg~='))
foundAttributify = true
// importing scss @apply transforms is broken
if (!css.includes('.test-apply'))
expect(css).not.toContain('@apply')
})
htmlStyleBlocks.forEach((css) => {
if (!foundAttributify && css.includes('[bg~='))
foundAttributify = true
// importing scss @apply transforms is broken
if (!css.includes('.test-apply'))
expect(css).not.toContain('@apply')
})
expect(foundAttributify).toBeTruthy()
})
})

0 comments on commit e0f1588

Please sign in to comment.