Skip to content

Commit

Permalink
refactor: split executor based on module resolution (#3878)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va authored Aug 3, 2023
1 parent f8dfbd3 commit 47f5c3a
Show file tree
Hide file tree
Showing 7 changed files with 612 additions and 533 deletions.
3 changes: 3 additions & 0 deletions packages/vitest/src/runtime/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { distDir } from '../paths'
import { getWorkerState } from '../utils/global'
import { VitestMocker } from './mocker'
import { ExternalModulesExecutor } from './external-executor'
import { FileMap } from './vm/file-map'

const entryUrl = pathToFileURL(resolve(distDir, 'entry.js')).href

Expand Down Expand Up @@ -39,6 +40,7 @@ let _viteNode: {
export const packageCache = new Map<string, any>()
export const moduleCache = new ModuleCacheMap()
export const mockMap: MockMap = new Map()
export const fileMap = new FileMap()

export async function startViteNode(options: ContextExecutorOptions) {
if (_viteNode)
Expand Down Expand Up @@ -174,6 +176,7 @@ export class VitestExecutor extends ViteNodeRunner {
else {
this.externalModules = new ExternalModulesExecutor({
...options,
fileMap,
context: options.context,
packageCache: options.packageCache,
})
Expand Down
Loading

0 comments on commit 47f5c3a

Please sign in to comment.