mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
chore: avoid inlining deps in vitest (#21316)
This commit is contained in:
parent
7512a52488
commit
5614ef9b8f
@ -9,12 +9,6 @@ import _vuePlugin from '@vitejs/plugin-vue'
|
|||||||
import { TreeShakeTemplatePlugin } from '../src/components/tree-shake'
|
import { TreeShakeTemplatePlugin } from '../src/components/tree-shake'
|
||||||
import { fixtureDir, normalizeLineEndings } from './utils'
|
import { fixtureDir, normalizeLineEndings } from './utils'
|
||||||
|
|
||||||
vi.mock('node:crypto', () => ({
|
|
||||||
update: vi.fn().mockReturnThis(),
|
|
||||||
digest: vi.fn().mockReturnValue('one-hash-to-rule-them-all'),
|
|
||||||
createHash: vi.fn().mockReturnThis()
|
|
||||||
}))
|
|
||||||
|
|
||||||
// mock due to differences of results between windows and linux
|
// mock due to differences of results between windows and linux
|
||||||
vi.spyOn(path, 'relative').mockImplementation((from: string, to: string) => {
|
vi.spyOn(path, 'relative').mockImplementation((from: string, to: string) => {
|
||||||
if (to.includes('SomeComponent')) {
|
if (to.includes('SomeComponent')) {
|
||||||
@ -188,7 +182,7 @@ describe('treeshake client only in ssr', () => {
|
|||||||
expect(treeshaken).not.toContain('ssrRenderComponent(_unref(HelloWorld')
|
expect(treeshaken).not.toContain('ssrRenderComponent(_unref(HelloWorld')
|
||||||
expect(treeshaken).toContain('ssrRenderComponent(_unref(Glob')
|
expect(treeshaken).toContain('ssrRenderComponent(_unref(Glob')
|
||||||
}
|
}
|
||||||
expect(treeshaken).toMatchSnapshot()
|
expect(treeshaken.replace(/data-v-[\d\w]{8}/g, 'data-v-one-hash').replace(/scoped=[\d\w]{8}/g, 'scoped=one-hash')).toMatchSnapshot()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -14,7 +14,6 @@ export default defineConfig({
|
|||||||
test: {
|
test: {
|
||||||
globalSetup: 'test/setup.ts',
|
globalSetup: 'test/setup.ts',
|
||||||
testTimeout: isWindows ? 60000 : 10000,
|
testTimeout: isWindows ? 60000 : 10000,
|
||||||
deps: { inline: ['@vitejs/plugin-vue'] },
|
|
||||||
// Excluded plugin because it should throw an error when accidentally loaded via Nuxt
|
// Excluded plugin because it should throw an error when accidentally loaded via Nuxt
|
||||||
exclude: [...configDefaults.exclude, '**/this-should-not-load.spec.js'],
|
exclude: [...configDefaults.exclude, '**/this-should-not-load.spec.js'],
|
||||||
maxThreads: process.env.TEST_ENV === 'dev' ? 1 : undefined,
|
maxThreads: process.env.TEST_ENV === 'dev' ? 1 : undefined,
|
||||||
|
Loading…
Reference in New Issue
Block a user