diff --git a/packages/vitest/src/integrations/env/edge-runtime.ts b/packages/vitest/src/integrations/env/edge-runtime.ts index 875544c08a32..84184af41b37 100644 --- a/packages/vitest/src/integrations/env/edge-runtime.ts +++ b/packages/vitest/src/integrations/env/edge-runtime.ts @@ -1,4 +1,3 @@ -import { importModule } from 'local-pkg' import type { Environment } from '../../types' import { populateGlobal } from './utils' import { KEYS } from './jsdom-keys' @@ -7,7 +6,7 @@ export default ({ name: 'edge-runtime', transformMode: 'ssr', async setupVM() { - const { EdgeVM } = await importModule('@edge-runtime/vm') as typeof import('@edge-runtime/vm') + const { EdgeVM } = await import('@edge-runtime/vm') const vm = new EdgeVM({ extend: (context) => { context.global = context @@ -25,7 +24,7 @@ export default ({ } }, async setup(global) { - const { EdgeVM } = await importModule('@edge-runtime/vm') as typeof import('@edge-runtime/vm') + const { EdgeVM } = await import('@edge-runtime/vm') const vm = new EdgeVM({ extend: (context) => { context.global = context diff --git a/packages/vitest/src/integrations/env/happy-dom.ts b/packages/vitest/src/integrations/env/happy-dom.ts index 5f0bf594d6a3..fe7a0d3602da 100644 --- a/packages/vitest/src/integrations/env/happy-dom.ts +++ b/packages/vitest/src/integrations/env/happy-dom.ts @@ -1,4 +1,3 @@ -import { importModule } from 'local-pkg' import type { Environment } from '../../types' import { populateGlobal } from './utils' @@ -6,7 +5,7 @@ export default ({ name: 'happy-dom', transformMode: 'web', async setupVM({ happyDOM = {} }) { - const { Window } = await importModule('happy-dom') as typeof import('happy-dom') + const { Window } = await import('happy-dom') const win = new Window({ ...happyDOM, console: (console && globalThis.console) ? globalThis.console : undefined, @@ -36,7 +35,7 @@ export default ({ async setup(global, { happyDOM = {} }) { // happy-dom v3 introduced a breaking change to Window, but // provides GlobalWindow as a way to use previous behaviour - const { Window, GlobalWindow } = await importModule('happy-dom') as typeof import('happy-dom') + const { Window, GlobalWindow } = await import('happy-dom') const win = new (GlobalWindow || Window)({ ...happyDOM, console: (console && global.console) ? global.console : undefined, diff --git a/packages/vitest/src/integrations/env/jsdom.ts b/packages/vitest/src/integrations/env/jsdom.ts index be93db798cf1..ef4937585ed9 100644 --- a/packages/vitest/src/integrations/env/jsdom.ts +++ b/packages/vitest/src/integrations/env/jsdom.ts @@ -1,4 +1,3 @@ -import { importModule } from 'local-pkg' import type { Environment } from '../../types' import { populateGlobal } from './utils' @@ -35,7 +34,7 @@ export default ({ JSDOM, ResourceLoader, VirtualConsole, - } = await importModule('jsdom') as typeof import('jsdom') + } = await import('jsdom') const { html = '', userAgent, @@ -107,7 +106,7 @@ export default ({ JSDOM, ResourceLoader, VirtualConsole, - } = await importModule('jsdom') as typeof import('jsdom') + } = await import('jsdom') const { html = '', userAgent,