diff --git a/packages/ui/client/auto-imports.d.ts b/packages/ui/client/auto-imports.d.ts index 1c97dd711fb4..8185410d6a10 100644 --- a/packages/ui/client/auto-imports.d.ts +++ b/packages/ui/client/auto-imports.d.ts @@ -129,6 +129,8 @@ declare global { const toRef: typeof import('vue')['toRef'] const toRefs: typeof import('vue')['toRefs'] const toValue: typeof import('vue')['toValue'] + const toggleDark: typeof import('./composables/dark')['toggleDark'] + const totalTests: typeof import('./composables/summary')['totalTests'] const triggerRef: typeof import('vue')['triggerRef'] const tryOnBeforeMount: typeof import('@vueuse/core')['tryOnBeforeMount'] const tryOnBeforeUnmount: typeof import('@vueuse/core')['tryOnBeforeUnmount'] diff --git a/packages/vitest/src/integrations/env/edge-runtime.ts b/packages/vitest/src/integrations/env/edge-runtime.ts index 1ccc055d7e64..5761a1339ae5 100644 --- a/packages/vitest/src/integrations/env/edge-runtime.ts +++ b/packages/vitest/src/integrations/env/edge-runtime.ts @@ -1,8 +1,9 @@ +import type vm from 'node:vm' import { importModule } from 'local-pkg' import type { Environment } from '../../types' import { populateGlobal } from './utils' -export default ({ +export default ({ name: 'edge-runtime', transformMode: 'ssr', async setupVM() { @@ -16,7 +17,7 @@ export default ({ }) return { getVmContext() { - return vm.context + return vm.context as vm.Context }, teardown() { // TODO @@ -40,4 +41,4 @@ export default ({ }, } }, -}) +}) satisfies Environment diff --git a/packages/vitest/src/integrations/env/happy-dom.ts b/packages/vitest/src/integrations/env/happy-dom.ts index cb05c9824b1f..f5c1c1a52b27 100644 --- a/packages/vitest/src/integrations/env/happy-dom.ts +++ b/packages/vitest/src/integrations/env/happy-dom.ts @@ -2,10 +2,10 @@ import { importModule } from 'local-pkg' import type { Environment } from '../../types' import { populateGlobal } from './utils' -export default ({ +export default ({ name: 'happy-dom', transformMode: 'web', - async setupVm() { + async setupVM() { const { Window } = await importModule('happy-dom') as typeof import('happy-dom') const win = new Window() @@ -40,4 +40,4 @@ export default ({ }, } }, -}) +}) satisfies Environment diff --git a/packages/vitest/src/integrations/env/jsdom.ts b/packages/vitest/src/integrations/env/jsdom.ts index 6310f00a9d80..26a983b84551 100644 --- a/packages/vitest/src/integrations/env/jsdom.ts +++ b/packages/vitest/src/integrations/env/jsdom.ts @@ -26,7 +26,7 @@ function catchWindowErrors(window: Window) { } } -export default ({ +export default ({ name: 'jsdom', transformMode: 'web', async setupVM({ jsdom = {} }) { @@ -125,4 +125,4 @@ export default ({ }, } }, -}) +}) satisfies Environment diff --git a/packages/vitest/src/integrations/env/node.ts b/packages/vitest/src/integrations/env/node.ts index bb15a319707b..3434267d9f14 100644 --- a/packages/vitest/src/integrations/env/node.ts +++ b/packages/vitest/src/integrations/env/node.ts @@ -30,7 +30,7 @@ const nodeGlobals = new Map( }), ) -export default ({ +export default ({ name: 'node', transformMode: 'ssr', // this is largely copied from jest's node environment @@ -120,4 +120,4 @@ export default ({ }, } }, -}) +}) satisfies Environment diff --git a/packages/vitest/src/runtime/vm.ts b/packages/vitest/src/runtime/vm.ts index 7c3bcae9ae1c..2595ab30960a 100644 --- a/packages/vitest/src/runtime/vm.ts +++ b/packages/vitest/src/runtime/vm.ts @@ -39,9 +39,11 @@ export async function run(ctx: WorkerContext) { const environment = await loadEnvironment(ctx.environment.name, ctx.config.root) if (!environment.setupVM) { + const envName = ctx.environment.name + const packageId = envName[0] === '.' ? envName : `vitest-environment-${envName}` throw new TypeError( `Environment "${ctx.environment.name}" is not a valid environment. ` - + `Package "vitest-environment-${name}" doesn't support vm environment because it doesn't provide "setupVM" method.`, + + `Path "${packageId}" doesn't support vm environment because it doesn't provide "setupVM" method.`, ) } diff --git a/test/core/vitest.config.ts b/test/core/vitest.config.ts index ef7aa367ee9e..d2252dd7b2dc 100644 --- a/test/core/vitest.config.ts +++ b/test/core/vitest.config.ts @@ -49,10 +49,6 @@ export default defineConfig({ setupFiles: [ './test/setup.ts', ], - // TODO: remove this when PR is done - poolMatchGlobs: [ - ['**/*', 'experimentalVmThreads'], - ], testNamePattern: '^((?!does not include test that).)*$', coverage: { provider: 'istanbul',