mirror of
https://github.com/nuxt/nuxt.git
synced 2025-03-20 08:15:59 +00:00
test: normalise scoped css + pass logger to configResolved
This commit is contained in:
parent
24e2c327b4
commit
8d3bd4f9fa
@ -3,6 +3,7 @@ import path from 'node:path'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import * as VueCompilerSFC from 'vue/compiler-sfc'
|
||||
import type { Plugin } from 'vite'
|
||||
import { createLogger } from 'vite'
|
||||
import type { Options } from '@vitejs/plugin-vue'
|
||||
import _vuePlugin from '@vitejs/plugin-vue'
|
||||
import { TreeShakeTemplatePlugin } from '../src/components/plugins/tree-shake'
|
||||
@ -66,6 +67,7 @@ async function SFCCompile (name: string, source: string, options: Options, ssr =
|
||||
})
|
||||
// @ts-expect-error Types are not correct as they are too generic
|
||||
plugin.configResolved!({
|
||||
logger: createLogger(),
|
||||
isProduction: options.isProduction,
|
||||
command: 'build',
|
||||
root: process.cwd(),
|
||||
|
@ -2435,13 +2435,16 @@ describe('component islands', () => {
|
||||
// TODO: resolve dev bug triggered by earlier fetch of /vueuse-head page
|
||||
// https://github.com/nuxt/nuxt/blob/main/packages/nuxt/src/core/runtime/nitro/handlers/renderer.ts#L139
|
||||
result.head.link = result.head.link?.filter(l => typeof l.href !== 'string' || !l.href.includes('SharedComponent'))
|
||||
if (result.head.link?.[0]?.href) {
|
||||
result.head.link[0].href = result.head.link[0].href.replace(/scoped=[^?&]+/, 'scoped=xxxxx')
|
||||
}
|
||||
|
||||
expect(result.head).toMatchInlineSnapshot(`
|
||||
{
|
||||
"link": [
|
||||
{
|
||||
"crossorigin": "",
|
||||
"href": "/_nuxt/components/islands/PureComponent.vue?vue&type=style&index=0&scoped=c0c0cf89&lang.css",
|
||||
"href": "/_nuxt/components/islands/PureComponent.vue?vue&type=style&index=0&scoped=xxxxx&lang.css",
|
||||
"rel": "stylesheet",
|
||||
},
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user