mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-22 16:39:58 +00:00
test: update regexes
This commit is contained in:
parent
24e7f5556b
commit
90fad163be
@ -1864,7 +1864,7 @@ describe.skipIf(isDev() || isWebpack)('inlining component styles', () => {
|
|||||||
// @ts-expect-error ssssh! untyped secret property
|
// @ts-expect-error ssssh! untyped secret property
|
||||||
const publicDir = useTestContext().nuxt._nitro.options.output.publicDir
|
const publicDir = useTestContext().nuxt._nitro.options.output.publicDir
|
||||||
const files = await readdir(join(publicDir, '_nuxt')).catch(() => [])
|
const files = await readdir(join(publicDir, '_nuxt')).catch(() => [])
|
||||||
expect(files.map(m => m.replace(/\.[\w-]+(\.\w+)$/, '$1'))).toContain('css-only-asset.svg')
|
expect(files.map(m => m.replace(/-[\w-]+(\.\w+)$/, '$1'))).toContain('css-only-asset.svg')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should not include inlined CSS in generated CSS file', async () => {
|
it('should not include inlined CSS in generated CSS file', async () => {
|
||||||
@ -1892,7 +1892,7 @@ describe.skipIf(isDev() || isWebpack)('inlining component styles', () => {
|
|||||||
const html: string = await $fetch<string>('/styles')
|
const html: string = await $fetch<string>('/styles')
|
||||||
const cssFiles = html.match(/<link [^>]*href="[^"]*\.css"/g)
|
const cssFiles = html.match(/<link [^>]*href="[^"]*\.css"/g)
|
||||||
expect(cssFiles?.length).toBeGreaterThan(0)
|
expect(cssFiles?.length).toBeGreaterThan(0)
|
||||||
expect(cssFiles?.filter(m => m.includes('entry'))?.map(m => m.replace(/\.[^.]*\.css/, '.css'))).toMatchInlineSnapshot(`
|
expect(cssFiles?.filter(m => m.includes('entry'))?.map(m => m.replace(/-[^-]*\.css/, '.css'))).toMatchInlineSnapshot(`
|
||||||
[
|
[
|
||||||
"<link rel="stylesheet" href="/_nuxt/entry.css"",
|
"<link rel="stylesheet" href="/_nuxt/entry.css"",
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user