···6565```ts
6666import { createBirpc } from 'birpc'
6767import { parse, stringify } from 'flatted'
6868-import { WorkspaceProject, createMethodsRPC } from 'vitest/node'
6868+import { createMethodsRPC, WorkspaceProject } from 'vitest/node'
69697070function createRpc(project: WorkspaceProject, wss: WebSocketServer) {
7171 return createBirpc(
+1-1
docs/advanced/runner.md
···250250// ./utils/custom.js
251251import { createTaskCollector, getCurrentSuite, setFn } from 'vitest/suite'
252252253253-export { describe, beforeAll, afterAll } from 'vitest'
253253+export { afterAll, beforeAll, describe } from 'vitest'
254254255255// this function will be called during collection phase:
256256// don't call function handler here, add it to suite tasks
+1-1
docs/guide/mocking.md
···443443```js
444444import { afterAll, afterEach, beforeAll } from 'vitest'
445445import { setupServer } from 'msw/node'
446446-import { HttpResponse, graphql, http } from 'msw'
446446+import { graphql, http, HttpResponse } from 'msw'
447447448448const posts = [
449449 {
+3-3
packages/browser/rollup.config.js
···11import { createRequire } from 'node:module'
22-import esbuild from 'rollup-plugin-esbuild'
33-import dts from 'rollup-plugin-dts'
44-import resolve from '@rollup/plugin-node-resolve'
52import commonjs from '@rollup/plugin-commonjs'
63import json from '@rollup/plugin-json'
44+import resolve from '@rollup/plugin-node-resolve'
75import { defineConfig } from 'rollup'
66+import dts from 'rollup-plugin-dts'
77+import esbuild from 'rollup-plugin-esbuild'
8899const require = createRequire(import.meta.url)
1010const pkg = require('./package.json')
+2-2
packages/coverage-istanbul/rollup.config.js
···11import { builtinModules, createRequire } from 'node:module'
22-import esbuild from 'rollup-plugin-esbuild'
33-import dts from 'rollup-plugin-dts'
42import commonjs from '@rollup/plugin-commonjs'
53import json from '@rollup/plugin-json'
64import nodeResolve from '@rollup/plugin-node-resolve'
75import { join } from 'pathe'
66+import dts from 'rollup-plugin-dts'
77+import esbuild from 'rollup-plugin-esbuild'
8899const require = createRequire(import.meta.url)
1010const pkg = require('./package.json')
+2-2
packages/coverage-v8/rollup.config.js
···11import { builtinModules, createRequire } from 'node:module'
22-import esbuild from 'rollup-plugin-esbuild'
33-import dts from 'rollup-plugin-dts'
42import commonjs from '@rollup/plugin-commonjs'
53import json from '@rollup/plugin-json'
64import nodeResolve from '@rollup/plugin-node-resolve'
75import { join } from 'pathe'
66+import dts from 'rollup-plugin-dts'
77+import esbuild from 'rollup-plugin-esbuild'
8899const require = createRequire(import.meta.url)
1010const pkg = require('./package.json')
+1-1
packages/expect/README.md
···55## Usage
6677```js
88-import * as chai from 'chai'
98import {
109 JestAsymmetricMatchers,
1110 JestChaiExpect,
1211 JestExtend,
1312} from '@vitest/expect'
1313+import * as chai from 'chai'
14141515// allows using expect.extend instead of chai.use to extend plugins
1616chai.use(JestExtend)
+2-2
packages/expect/rollup.config.js
···11import { builtinModules, createRequire } from 'node:module'
22-import esbuild from 'rollup-plugin-esbuild'
33-import dts from 'rollup-plugin-dts'
42import { defineConfig } from 'rollup'
53import copy from 'rollup-plugin-copy'
44+import dts from 'rollup-plugin-dts'
55+import esbuild from 'rollup-plugin-esbuild'
6677const require = createRequire(import.meta.url)
88const pkg = require('./package.json')
+5-5
packages/mocker/rollup.config.js
···11import { builtinModules, createRequire } from 'node:module'
22-import { defineConfig } from 'rollup'
33-import esbuild from 'rollup-plugin-esbuild'
44-import dts from 'rollup-plugin-dts'
55-import resolve from '@rollup/plugin-node-resolve'
66-import json from '@rollup/plugin-json'
72import commonjs from '@rollup/plugin-commonjs'
33+import json from '@rollup/plugin-json'
44+import resolve from '@rollup/plugin-node-resolve'
55+import { defineConfig } from 'rollup'
66+import dts from 'rollup-plugin-dts'
77+import esbuild from 'rollup-plugin-esbuild'
8899const require = createRequire(import.meta.url)
1010const pkg = require('./package.json')
+5-5
packages/pretty-format/rollup.config.js
···11import { builtinModules, createRequire } from 'node:module'
22-import { defineConfig } from 'rollup'
33-import esbuild from 'rollup-plugin-esbuild'
44-import dts from 'rollup-plugin-dts'
55-import resolve from '@rollup/plugin-node-resolve'
66-import json from '@rollup/plugin-json'
72import commonjs from '@rollup/plugin-commonjs'
33+import json from '@rollup/plugin-json'
44+import resolve from '@rollup/plugin-node-resolve'
55+import { defineConfig } from 'rollup'
66+import dts from 'rollup-plugin-dts'
77+import esbuild from 'rollup-plugin-esbuild'
8899const require = createRequire(import.meta.url)
1010const pkg = require('./package.json')
+2-2
packages/runner/rollup.config.js
···11import { builtinModules, createRequire } from 'node:module'
22-import esbuild from 'rollup-plugin-esbuild'
32import json from '@rollup/plugin-json'
44-import dts from 'rollup-plugin-dts'
53import { defineConfig } from 'rollup'
44+import dts from 'rollup-plugin-dts'
55+import esbuild from 'rollup-plugin-esbuild'
6677const require = createRequire(import.meta.url)
88const pkg = require('./package.json')
+3-3
packages/snapshot/rollup.config.js
···11import { builtinModules, createRequire } from 'node:module'
22-import esbuild from 'rollup-plugin-esbuild'
33-import nodeResolve from '@rollup/plugin-node-resolve'
44-import dts from 'rollup-plugin-dts'
52import commonjs from '@rollup/plugin-commonjs'
33+import nodeResolve from '@rollup/plugin-node-resolve'
64import { defineConfig } from 'rollup'
55+import dts from 'rollup-plugin-dts'
66+import esbuild from 'rollup-plugin-esbuild'
7788const require = createRequire(import.meta.url)
99const pkg = require('./package.json')
+2-2
packages/spy/rollup.config.js
···11import { builtinModules, createRequire } from 'node:module'
22-import esbuild from 'rollup-plugin-esbuild'
33-import dts from 'rollup-plugin-dts'
42import { defineConfig } from 'rollup'
33+import dts from 'rollup-plugin-dts'
44+import esbuild from 'rollup-plugin-esbuild'
5566const require = createRequire(import.meta.url)
77const pkg = require('./package.json')
+3-3
packages/ui/rollup.config.js
···11import { builtinModules, createRequire } from 'node:module'
22-import esbuild from 'rollup-plugin-esbuild'
33-import dts from 'rollup-plugin-dts'
44-import resolve from '@rollup/plugin-node-resolve'
52import commonjs from '@rollup/plugin-commonjs'
63import json from '@rollup/plugin-json'
44+import resolve from '@rollup/plugin-node-resolve'
55+import dts from 'rollup-plugin-dts'
66+import esbuild from 'rollup-plugin-esbuild'
7788const require = createRequire(import.meta.url)
99const pkg = require('./package.json')
+6-6
packages/ui/vite.config.ts
···11-import { resolve } from 'pathe'
21import type { UserConfig } from 'vite'
33-import { defineConfig } from 'vite'
42import Vue from '@vitejs/plugin-vue'
55-import Components from 'unplugin-vue-components/vite'
66-import AutoImport from 'unplugin-auto-import/vite'
77-import Unocss from 'unocss/vite'
88-import Pages from 'vite-plugin-pages'
33+import { resolve } from 'pathe'
94import { presetAttributify, presetIcons, presetUno, transformerDirectives } from 'unocss'
55+import Unocss from 'unocss/vite'
66+import AutoImport from 'unplugin-auto-import/vite'
77+import Components from 'unplugin-vue-components/vite'
88+import { defineConfig } from 'vite'
99+import Pages from 'vite-plugin-pages'
10101111// for debug:
1212// open a static file serve to share the report json
+5-5
packages/utils/rollup.config.js
···11import { builtinModules, createRequire } from 'node:module'
22-import { defineConfig } from 'rollup'
33-import esbuild from 'rollup-plugin-esbuild'
44-import dts from 'rollup-plugin-dts'
55-import resolve from '@rollup/plugin-node-resolve'
66-import json from '@rollup/plugin-json'
72import commonjs from '@rollup/plugin-commonjs'
33+import json from '@rollup/plugin-json'
44+import resolve from '@rollup/plugin-node-resolve'
55+import { defineConfig } from 'rollup'
66+import dts from 'rollup-plugin-dts'
77+import esbuild from 'rollup-plugin-esbuild'
8899const require = createRequire(import.meta.url)
1010const pkg = require('./package.json')
+1-1
packages/vite-node/README.md
···83838484```ts
8585import { createServer } from 'vite'
8686-import { ViteNodeServer } from 'vite-node/server'
8786import { ViteNodeRunner } from 'vite-node/client'
8787+import { ViteNodeServer } from 'vite-node/server'
8888import { installSourcemapsSupport } from 'vite-node/source-map'
89899090// create vite server
+3-3
packages/vite-node/rollup.config.js
···11import { builtinModules, createRequire } from 'node:module'
22-import esbuild from 'rollup-plugin-esbuild'
33-import dts from 'rollup-plugin-dts'
44-import resolve from '@rollup/plugin-node-resolve'
52import commonjs from '@rollup/plugin-commonjs'
63import json from '@rollup/plugin-json'
44+import resolve from '@rollup/plugin-node-resolve'
75import { defineConfig } from 'rollup'
66+import dts from 'rollup-plugin-dts'
77+import esbuild from 'rollup-plugin-esbuild'
8899const require = createRequire(import.meta.url)
1010const pkg = require('./package.json')
+6-6
packages/vitest/rollup.config.js
···11import fs from 'node:fs'
22import { builtinModules, createRequire } from 'node:module'
33import { fileURLToPath } from 'node:url'
44-import { dirname, join, normalize, resolve } from 'pathe'
55-import esbuild from 'rollup-plugin-esbuild'
66-import dts from 'rollup-plugin-dts'
77-import nodeResolve from '@rollup/plugin-node-resolve'
84import commonjs from '@rollup/plugin-commonjs'
95import json from '@rollup/plugin-json'
1010-import license from 'rollup-plugin-license'
66+import nodeResolve from '@rollup/plugin-node-resolve'
117import fg from 'fast-glob'
1212-import c from 'tinyrainbow'
88+import { dirname, join, normalize, resolve } from 'pathe'
139import { defineConfig } from 'rollup'
1010+import dts from 'rollup-plugin-dts'
1111+import esbuild from 'rollup-plugin-esbuild'
1212+import license from 'rollup-plugin-license'
1313+import c from 'tinyrainbow'
14141515const require = createRequire(import.meta.url)
1616const pkg = require('./package.json')
+3-3
packages/web-worker/rollup.config.js
···11import { createRequire } from 'node:module'
22-import esbuild from 'rollup-plugin-esbuild'
33-import dts from 'rollup-plugin-dts'
42import commonjs from '@rollup/plugin-commonjs'
55-import nodeResolve from '@rollup/plugin-node-resolve'
63import json from '@rollup/plugin-json'
44+import nodeResolve from '@rollup/plugin-node-resolve'
55+import dts from 'rollup-plugin-dts'
66+import esbuild from 'rollup-plugin-esbuild'
7788const require = createRequire(import.meta.url)
99const pkg = require('./package.json')
+3-3
packages/ws-client/rollup.config.js
···11-import esbuild from 'rollup-plugin-esbuild'
22-import dts from 'rollup-plugin-dts'
33-import resolve from '@rollup/plugin-node-resolve'
41import commonjs from '@rollup/plugin-commonjs'
52import json from '@rollup/plugin-json'
33+import resolve from '@rollup/plugin-node-resolve'
44+import dts from 'rollup-plugin-dts'
55+import esbuild from 'rollup-plugin-esbuild'
6677const entry = ['src/index.ts']
88
+1-1
test/browser/vitest.config.mts
···11+import type { BrowserCommand } from 'vitest/node'
12import { dirname, resolve } from 'node:path'
23import { fileURLToPath } from 'node:url'
34import * as util from 'node:util'
45import { defineConfig } from 'vitest/config'
55-import type { BrowserCommand } from 'vitest/node'
6677const dir = dirname(fileURLToPath(import.meta.url))
88
+1-1
test/cli/custom.ts
···11+import type { Environment } from 'vitest'
12import vm from 'node:vm'
23import debug from 'debug'
33-import type { Environment } from 'vitest'
4455// test that external packages (debug) are loaded correctly
66const log = debug('test:env')
+4-4
test/coverage-test/utils.ts
···11+import type { FileCoverageData } from 'istanbul-lib-coverage'
22+import type { TestFunction } from 'vitest'
33+import type { UserConfig } from 'vitest/node'
14import { readFileSync } from 'node:fs'
25import { resolve } from 'node:path'
36import { fileURLToPath } from 'node:url'
47import { stripVTControlCharacters } from 'node:util'
55-import { normalize } from 'pathe'
68import libCoverage from 'istanbul-lib-coverage'
77-import type { FileCoverageData } from 'istanbul-lib-coverage'
88-import type { TestFunction } from 'vitest'
99+import { normalize } from 'pathe'
910import { vi, describe as vitestDescribe, test as vitestTest } from 'vitest'
1010-import type { UserConfig } from 'vitest/node'
1111import * as testUtils from '../test-utils'
12121313export function test(name: string, fn: TestFunction, skip = false) {
+1-1
test/public-mocker/vite.config.ts
···11-import { defineConfig } from 'vite'
21import { mockerPlugin } from '@vitest/mocker/node'
22+import { defineConfig } from 'vite'
3344export default defineConfig({
55 root: 'fixtures/redirect',
+8-8
test/test-utils/index.ts
···11-import { Readable, Writable } from 'node:stream'
22-import fs from 'node:fs'
33-import { fileURLToPath } from 'node:url'
44-import type { UserConfig as ViteUserConfig } from 'vite'
55-import { type WorkerGlobalState, afterEach, onTestFinished } from 'vitest'
66-import type { UserConfig, Vitest, VitestRunMode } from 'vitest/node'
77-import { startVitest } from 'vitest/node'
81import type { Options } from 'tinyexec'
99-import { x } from 'tinyexec'
22+import type { UserConfig as ViteUserConfig } from 'vite'
33+import type { UserConfig, Vitest, VitestRunMode } from 'vitest/node'
44+import fs from 'node:fs'
55+import { Readable, Writable } from 'node:stream'
66+import { fileURLToPath } from 'node:url'
107import { dirname, resolve } from 'pathe'
88+import { x } from 'tinyexec'
99+import { afterEach, onTestFinished, type WorkerGlobalState } from 'vitest'
1010+import { startVitest } from 'vitest/node'
1111import { getCurrentTest } from 'vitest/suite'
1212import { Cli } from './cli'
1313
+1-1
test/workspaces-browser/globalTest.ts
···11-import { readFile } from 'node:fs/promises'
21import assert from 'node:assert/strict'
22+import { readFile } from 'node:fs/promises'
3344let teardownCalled = false
55
+2-2
test/workspaces/globalTest.ts
···11-import { readFile } from 'node:fs/promises'
22-import assert from 'node:assert/strict'
31import type { GlobalSetupContext } from 'vitest/node'
22+import assert from 'node:assert/strict'
33+import { readFile } from 'node:fs/promises'
4455declare module 'vitest' {
66 interface ProvidedContext {
+3-3
test/workspaces/vitest.workspace.ts
···11-import { defineWorkspace } from 'vitest/config'
22-import MagicString from 'magic-string'
33-import remapping from '@ampproject/remapping'
41import type { Plugin } from 'vite'
22+import remapping from '@ampproject/remapping'
33+import MagicString from 'magic-string'
44+import { defineWorkspace } from 'vitest/config'
5566export default defineWorkspace([
77 'space_2',
+1-1
docs/.vitepress/components/ListItem.vue
···11<script setup lang="ts">
22-import { computed, effectScope, onMounted, ref } from 'vue'
32import { until, useElementVisibility } from '@vueuse/core'
33+import { computed, effectScope, onMounted, ref } from 'vue'
4455const el = ref<HTMLDivElement>()
66const state = ref(0)
+1-1
docs/.vitepress/scripts/cli-generator.ts
···11+import type { CLIOption, CLIOptions } from '../../../packages/vitest/src/node/cli/cli-config'
12import { writeFileSync } from 'node:fs'
23import { dirname, resolve } from 'node:path'
34import { fileURLToPath } from 'node:url'
44-import type { CLIOption, CLIOptions } from '../../../packages/vitest/src/node/cli/cli-config'
55import { cliOptionsConfig } from '../../../packages/vitest/src/node/cli/cli-config'
6677const docsDir = resolve(dirname(fileURLToPath(import.meta.url)), '../..')
···11-import { h } from 'vue'
21import type { Theme } from 'vitepress'
33-import DefaultTheme from 'vitepress/theme'
22+import TwoslashFloatingVue from '@shikijs/vitepress-twoslash/client'
43import { inBrowser } from 'vitepress'
44+import DefaultTheme from 'vitepress/theme'
55+import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client'
66+import { h } from 'vue'
77+import HomePage from '../components/HomePage.vue'
88+import Version from '../components/Version.vue'
59import '../style/main.css'
610import '../style/vars.css'
711import 'uno.css'
88-import TwoslashFloatingVue from '@shikijs/vitepress-twoslash/client'
99-import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client'
1010-import HomePage from '../components/HomePage.vue'
1111-import Version from '../components/Version.vue'
1212import '@shikijs/vitepress-twoslash/style.css'
13131414if (inBrowser) {
+2-2
examples/fastify/test/app.test.ts
···11-import { afterAll, expect, test } from 'vitest'
21import supertest from 'supertest'
22+import { afterAll, expect, test } from 'vitest'
3344-import app from '../src/app'
54import { usersData } from '../mockData'
55+import app from '../src/app'
6677test('with HTTP injection', async () => {
88 const response = await app.inject({
+1-1
examples/lit/src/my-button.ts
···11-import { LitElement, css, html } from 'lit'
11+import { css, html, LitElement } from 'lit'
22import { customElement, property } from 'lit/decorators.js'
3344/**
+1-1
examples/lit/test/basic.test.ts
···11-import { beforeEach, describe, expect, it } from 'vitest'
21import { page } from '@vitest/browser/context'
22+import { beforeEach, describe, expect, it } from 'vitest'
3344import '../src/my-button.js'
55
+1-1
packages/coverage-istanbul/src/index.ts
···11-import { COVERAGE_STORE_KEY } from './constants'
21import type { IstanbulCoverageProvider } from './provider'
22+import { COVERAGE_STORE_KEY } from './constants'
3344export async function getProvider(): Promise<IstanbulCoverageProvider> {
55 // to not bundle the provider
+9-9
packages/coverage-istanbul/src/provider.ts
···11-import { promises as fs } from 'node:fs'
22-import { resolve } from 'pathe'
31import type { CoverageProvider, ReportContext, ResolvedCoverageOptions, Vitest } from 'vitest/node'
44-import { BaseCoverageProvider } from 'vitest/coverage'
55-import c from 'tinyrainbow'
66-import { parseModule } from 'magicast'
22+import { promises as fs } from 'node:fs'
73import createDebug from 'debug'
88-import TestExclude from 'test-exclude'
99-import libReport from 'istanbul-lib-report'
1010-import reports from 'istanbul-reports'
114import libCoverage, { type CoverageMap } from 'istanbul-lib-coverage'
55+import { createInstrumenter, type Instrumenter } from 'istanbul-lib-instrument'
66+import libReport from 'istanbul-lib-report'
127import libSourceMaps from 'istanbul-lib-source-maps'
1313-import { type Instrumenter, createInstrumenter } from 'istanbul-lib-instrument'
88+import reports from 'istanbul-reports'
99+import { parseModule } from 'magicast'
1010+import { resolve } from 'pathe'
1111+import TestExclude from 'test-exclude'
1212+import c from 'tinyrainbow'
1313+import { BaseCoverageProvider } from 'vitest/coverage'
1414// @ts-expect-error missing types
1515import { defaults as istanbulDefaults } from '@istanbuljs/schema'
1616
+1-1
packages/coverage-v8/src/browser.ts
···11-import { cdp } from '@vitest/browser/context'
21import type { V8CoverageProvider } from './provider'
22+import { cdp } from '@vitest/browser/context'
33import { loadProvider } from './load-provider'
4455const session = cdp()
+1-1
packages/coverage-v8/src/index.ts
···11+import type { V8CoverageProvider } from './provider'
12import inspector, { type Profiler } from 'node:inspector'
23import { provider } from 'std-env'
33-import type { V8CoverageProvider } from './provider'
44import { loadProvider } from './load-provider'
5566const session = new inspector.Session()
+12-12
packages/coverage-v8/src/provider.ts
···11+import type { CoverageMap } from 'istanbul-lib-coverage'
12import type { Profiler } from 'node:inspector'
22-import { fileURLToPath, pathToFileURL } from 'node:url'
33+import type { EncodedSourceMap, FetchResult } from 'vite-node'
44+import type { AfterSuiteRunMeta } from 'vitest'
55+import type { CoverageProvider, ReportContext, ResolvedCoverageOptions, Vitest, WorkspaceProject } from 'vitest/node'
36import { promises as fs } from 'node:fs'
44-import v8ToIstanbul from 'v8-to-istanbul'
77+import { fileURLToPath, pathToFileURL } from 'node:url'
88+import remapping from '@ampproject/remapping'
59import { mergeProcessCovs } from '@bcoe/v8-coverage'
1010+import createDebug from 'debug'
611import libCoverage from 'istanbul-lib-coverage'
712import libReport from 'istanbul-lib-report'
813import libSourceMaps from 'istanbul-lib-source-maps'
914import reports from 'istanbul-reports'
1010-import type { CoverageMap } from 'istanbul-lib-coverage'
1515+import MagicString from 'magic-string'
1616+import { parseModule } from 'magicast'
1117import { normalize, resolve } from 'pathe'
1218import { provider } from 'std-env'
1313-import c from 'tinyrainbow'
1414-import createDebug from 'debug'
1515-import MagicString from 'magic-string'
1619import TestExclude from 'test-exclude'
1717-import remapping from '@ampproject/remapping'
1818-import { BaseCoverageProvider } from 'vitest/coverage'
2020+import c from 'tinyrainbow'
2121+import v8ToIstanbul from 'v8-to-istanbul'
1922import { cleanUrl } from 'vite-node/utils'
2020-import type { AfterSuiteRunMeta } from 'vitest'
2121-import type { CoverageProvider, ReportContext, ResolvedCoverageOptions, Vitest, WorkspaceProject } from 'vitest/node'
2222-import type { EncodedSourceMap, FetchResult } from 'vite-node'
23232424-import { parseModule } from 'magicast'
2424+import { BaseCoverageProvider } from 'vitest/coverage'
2525import { version } from '../package.json' with { type: 'json' }
26262727type TransformResults = Map<string, FetchResult>
+5-5
packages/expect/src/index.ts
···11-export * from './jest-asymmetric-matchers'
22-export * from './jest-utils'
31export * from './constants'
44-export * from './types'
55-export { getState, setState } from './state'
22+export * from './jest-asymmetric-matchers'
63export { JestChaiExpect } from './jest-expect'
77-export { addCustomEqualityTesters } from './jest-matcher-utils'
84export { JestExtend } from './jest-extend'
55+export { addCustomEqualityTesters } from './jest-matcher-utils'
66+export * from './jest-utils'
77+export { getState, setState } from './state'
88+export * from './types'
+2-2
packages/expect/src/jest-asymmetric-matchers.ts
···11import type { ChaiPlugin, MatcherState } from './types'
22import { GLOBAL_EXPECT } from './constants'
33-import { getState } from './state'
43import {
54 diff,
65 getCustomEqualityTesters,
76 getMatcherUtils,
87 stringify,
98} from './jest-matcher-utils'
1010-119import {
1210 equals,
1311 isA,
···1513 pluralize,
1614 subsetEquality,
1715} from './jest-utils'
1616+1717+import { getState } from './state'
18181919export interface AsymmetricMatcherInterface {
2020 asymmetricMatch: (other: unknown) => boolean
+12-12
packages/expect/src/jest-expect.ts
···11+import type { Test } from '@vitest/runner'
22+import type { MockInstance, MockResult, MockSettledResult } from '@vitest/spy'
33+import type { Constructable } from '@vitest/utils'
44+import type { AsymmetricMatcher } from './jest-asymmetric-matchers'
55+import type { Assertion, ChaiPlugin } from './types'
66+import { isMockFunction } from '@vitest/spy'
17import { assertTypes } from '@vitest/utils'
28import c from 'tinyrainbow'
33-import type { Constructable } from '@vitest/utils'
44-import type { MockInstance, MockResult, MockSettledResult } from '@vitest/spy'
55-import { isMockFunction } from '@vitest/spy'
66-import type { Test } from '@vitest/runner'
77-import type { Assertion, ChaiPlugin } from './types'
99+import { JEST_MATCHERS_OBJECT } from './constants'
1010+import {
1111+ diff,
1212+ getCustomEqualityTesters,
1313+ stringify,
1414+} from './jest-matcher-utils'
815import {
916 arrayBufferEquality,
1017 generateToBeMessage,
···1522 subsetEquality,
1623 typeEquality,
1724} from './jest-utils'
1818-import type { AsymmetricMatcher } from './jest-asymmetric-matchers'
1919-import {
2020- diff,
2121- getCustomEqualityTesters,
2222- stringify,
2323-} from './jest-matcher-utils'
2424-import { JEST_MATCHERS_OBJECT } from './constants'
2525import { recordAsyncExpect, wrapAssertion } from './utils'
26262727// polyfill globals because expect can be used in node environment
+4-4
packages/expect/src/jest-extend.ts
···11-import { use, util } from 'chai'
21import type {
32 ChaiPlugin,
43 ExpectStatic,
55- MatcherState,
64 MatchersObject,
55+ MatcherState,
76 SyncExpectationResult,
87} from './types'
88+import { use, util } from 'chai'
99import { ASYMMETRIC_MATCHERS_OBJECT, JEST_MATCHERS_OBJECT } from './constants'
1010import { AsymmetricMatcher } from './jest-asymmetric-matchers'
1111-import { getState } from './state'
1212-1311import {
1412 diff,
1513 getCustomEqualityTesters,
···1816} from './jest-matcher-utils'
19172018import { equals, iterableEquality, subsetEquality } from './jest-utils'
1919+2020+import { getState } from './state'
2121import { wrapAssertion } from './utils'
22222323function getMatcherState(
+3-3
packages/expect/src/jest-matcher-utils.ts
···11-import { getType, stringify } from '@vitest/utils'
22-import c from 'tinyrainbow'
33-import { diff, printDiffOrStringify } from '@vitest/utils/diff'
41import type { MatcherHintOptions, Tester } from './types'
22+import { getType, stringify } from '@vitest/utils'
33+import { diff, printDiffOrStringify } from '@vitest/utils/diff'
44+import c from 'tinyrainbow'
55import { JEST_MATCHERS_OBJECT } from './constants'
6677export { diff } from '@vitest/utils/diff'
+1-1
packages/expect/src/jest-utils.ts
···22222323*/
24242525-import { isObject } from '@vitest/utils'
2625import type { Tester, TesterContext } from './types'
2626+import { isObject } from '@vitest/utils'
27272828// Extracted out of jasmine 2.5.2
2929export function equals(
+1-1
packages/expect/src/types.ts
···66 *
77 */
8899-import type { Formatter } from 'tinyrainbow'
109import type { Constructable } from '@vitest/utils'
1010+import type { Formatter } from 'tinyrainbow'
1111import type { diff, getMatcherUtils, stringify } from './jest-matcher-utils'
12121313export type ChaiPlugin = Chai.ChaiPlugin
+1-1
packages/expect/src/utils.ts
···11-import { processError } from '@vitest/utils/error'
21import type { Test } from '@vitest/runner/types'
32import type { Assertion } from './types'
33+import { processError } from '@vitest/utils/error'
4455export function recordAsyncExpect(
66 test: any,
+10-10
packages/mocker/src/index.ts
···11+export { mockObject } from './automocker'
22+export type { GlobalConstructors, MockObjectOptions } from './automocker'
33+14export {
22- MockerRegistry,
33- ManualMockedModule,
44- RedirectedModule,
55 AutomockedModule,
66 AutospiedModule,
77+ ManualMockedModule,
88+ MockerRegistry,
99+ RedirectedModule,
710} from './registry'
88-export { mockObject } from './automocker'
99-1010-export type { GlobalConstructors, MockObjectOptions } from './automocker'
1111export type {
1212- MockedModule,
1313- MockedModuleType,
1414- MockedModuleSerialized,
1512 AutomockedModuleSerialized,
1613 AutospiedModuleSerialized,
1717- RedirectedModuleSerialized,
1814 ManualMockedModuleSerialized,
1515+ MockedModule,
1616+ MockedModuleSerialized,
1717+ MockedModuleType,
1818+ RedirectedModuleSerialized,
1919} from './registry'
20202121export type {
+13-13
packages/pretty-format/src/index.ts
···55 * LICENSE file in the root directory of this source tree.
66 */
7788+import type {
99+ Colors,
1010+ Config,
1111+ NewPlugin,
1212+ Options,
1313+ OptionsReceived,
1414+ Plugin,
1515+ Plugins,
1616+ Refs,
1717+ Theme,
1818+} from './types'
819import styles from 'tinyrainbow'
920import {
1021 printIteratorEntries,
···1829import Immutable from './plugins/Immutable'
1930import ReactElement from './plugins/ReactElement'
2031import ReactTestComponent from './plugins/ReactTestComponent'
2121-import type {
2222- Colors,
2323- Config,
2424- NewPlugin,
2525- Options,
2626- OptionsReceived,
2727- Plugin,
2828- Plugins,
2929- Refs,
3030- Theme,
3131-} from './types'
32323333export type {
3434 Colors,
3535 CompareKeys,
3636 Config,
3737+ NewPlugin,
3838+ OldPlugin,
3739 Options,
3840 OptionsReceived,
3939- OldPlugin,
4040- NewPlugin,
4141 Plugin,
4242 Plugins,
4343 PrettyFormatOptions,
+11-11
packages/runner/src/collect.ts
···11-import { processError } from '@vitest/utils/error'
22-import { toArray } from '@vitest/utils'
33-import type { File, SuiteHooks } from './types/tasks'
41import type { VitestRunner } from './types/runner'
22+import type { File, SuiteHooks } from './types/tasks'
33+import { toArray } from '@vitest/utils'
44+import { processError } from '@vitest/utils/error'
55+import { collectorContext } from './context'
66+import { getHooks, setHooks } from './map'
77+import { runSetupFiles } from './setup'
88+import {
99+ clearCollectorContext,
1010+ createSuiteHooks,
1111+ getDefaultSuite,
1212+} from './suite'
513import {
614 calculateSuiteHash,
715 createFileTask,
816 interpretTaskModes,
917 someTasksAreOnly,
1018} from './utils/collect'
1111-import {
1212- clearCollectorContext,
1313- createSuiteHooks,
1414- getDefaultSuite,
1515-} from './suite'
1616-import { getHooks, setHooks } from './map'
1717-import { collectorContext } from './context'
1818-import { runSetupFiles } from './setup'
19192020const now = globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now
2121
+2-2
packages/runner/src/context.ts
···11import type { Awaitable } from '@vitest/utils'
22-import { getSafeTimers } from '@vitest/utils'
22+import type { VitestRunner } from './types/runner'
33import type {
44 Custom,
55 ExtendedContext,
···88 TaskContext,
99 Test,
1010} from './types/tasks'
1111-import type { VitestRunner } from './types/runner'
1111+import { getSafeTimers } from '@vitest/utils'
1212import { PendingError } from './errors'
13131414export const collectorContext: RuntimeContext = {
+1-1
packages/runner/src/fixture.ts
···11+import type { FixtureOptions, TestContext } from './types/tasks'
12import { createDefer, isObject } from '@vitest/utils'
23import { getFixture } from './map'
33-import type { FixtureOptions, TestContext } from './types/tasks'
4455export interface FixtureItem extends FixtureOptions {
66 prop: string
+3-3
packages/runner/src/hooks.ts
···11-import { assertTypes } from '@vitest/utils'
21import type {
32 AfterAllListener,
43 AfterEachListener,
···98 TaskHook,
109 TaskPopulated,
1110} from './types/tasks'
1212-import { getCurrentSuite, getRunner } from './suite'
1313-import { getCurrentTest } from './test-state'
1111+import { assertTypes } from '@vitest/utils'
1412import { withTimeout } from './context'
1513import { withFixtures } from './fixture'
1414+import { getCurrentSuite, getRunner } from './suite'
1515+import { getCurrentTest } from './test-state'
16161717function getDefaultHookTimeout() {
1818 return getRunner().config.hookTimeout
+14-14
packages/runner/src/index.ts
···11-export { startTests, updateTask, collectTests } from './run'
21export {
33- test,
44- it,
55- describe,
66- suite,
77- getCurrentSuite,
88- createTaskCollector,
99-} from './suite'
1010-export {
1111- beforeAll,
1212- beforeEach,
132 afterAll,
143 afterEach,
44+ beforeAll,
55+ beforeEach,
156 onTestFailed,
167 onTestFinished,
178} from './hooks'
1818-export { setFn, getFn, getHooks, setHooks } from './map'
99+export { getFn, getHooks, setFn, setHooks } from './map'
1010+export { collectTests, startTests, updateTask } from './run'
1111+export {
1212+ createTaskCollector,
1313+ describe,
1414+ getCurrentSuite,
1515+ it,
1616+ suite,
1717+ test,
1818+} from './suite'
1919export { getCurrentTest } from './test-state'
2020-export { processError } from '@vitest/utils/error'
2121-2220export type * from './types'
2121+2222+export { processError } from '@vitest/utils/error'
+1-1
packages/runner/src/map.ts
···11import type { Awaitable } from '@vitest/utils'
22-import type { Custom, Suite, SuiteHooks, Test, TestContext } from './types/tasks'
32import type { FixtureItem } from './fixture'
33+import type { Custom, Suite, SuiteHooks, Test, TestContext } from './types/tasks'
4455// use WeakMap here to make the Test and Suite object serializable
66const fnMap = new WeakMap()
+7-7
packages/runner/src/run.ts
···11import type { Awaitable } from '@vitest/utils'
22-import { getSafeTimers, shuffle } from '@vitest/utils'
33-import { processError } from '@vitest/utils/error'
42import type { DiffOptions } from '@vitest/utils/diff'
53import type { VitestRunner } from './types/runner'
64import type {
···1816 TaskState,
1917 Test,
2018} from './types/tasks'
2121-import { partitionSuiteChildren } from './utils/suite'
2222-import { limitConcurrency } from './utils/limit-concurrency'
2323-import { getFn, getHooks } from './map'
1919+import { getSafeTimers, shuffle } from '@vitest/utils'
2020+import { processError } from '@vitest/utils/error'
2421import { collectTests } from './collect'
2525-import { setCurrentTest } from './test-state'
2626-import { hasFailed, hasTests } from './utils/tasks'
2722import { PendingError } from './errors'
2823import { callFixtureCleanup } from './fixture'
2424+import { getFn, getHooks } from './map'
2525+import { setCurrentTest } from './test-state'
2626+import { limitConcurrency } from './utils/limit-concurrency'
2727+import { partitionSuiteChildren } from './utils/suite'
2828+import { hasFailed, hasTests } from './utils/tasks'
29293030const now = globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now
3131const unixNow = Date.now
+14-15
packages/runner/src/suite.ts
···11-import {
22- format,
33- isNegativeNaN,
44- isObject,
55- objDisplay,
66- objectAttr,
77- toArray,
88-} from '@vitest/utils'
99-import { parseSingleStack } from '@vitest/utils/source-map'
11+import type { FixtureItem } from './fixture'
22+import type { VitestRunner } from './types/runner'
103import type {
114 Custom,
125 CustomAPI,
···2619 TestFunction,
2720 TestOptions,
2821} from './types/tasks'
2929-import type { VitestRunner } from './types/runner'
3030-import { createChainable } from './utils/chain'
3122import {
3232- collectTask,
2323+ format,
2424+ isNegativeNaN,
2525+ isObject,
2626+ objDisplay,
2727+ objectAttr,
2828+ toArray,
2929+} from '@vitest/utils'
3030+import { parseSingleStack } from '@vitest/utils/source-map'
3131+import {
3332 collectorContext,
3333+ collectTask,
3434 createTestContext,
3535 runWithSuite,
3636 withTimeout,
3737} from './context'
3838-import { getHooks, setFixture, setFn, setHooks } from './map'
3939-import type { FixtureItem } from './fixture'
4038import { mergeContextFixtures, withFixtures } from './fixture'
3939+import { getHooks, setFixture, setFn, setHooks } from './map'
4140import { getCurrentTest } from './test-state'
4141+import { createChainable } from './utils/chain'
42424343/**
4444 * Creates a suite of tests, allowing for grouping and hierarchical organization of tests.
···499499}
500500501501function createSuite() {
502502- // eslint-disable-next-line unicorn/consistent-function-scoping
503502 function suiteFn(
504503 this: Record<string, boolean | undefined>,
505504 name: string | Function,
···11-import { deepMergeSnapshot } from './port/utils'
22-import SnapshotState from './port/state'
33-import type { SnapshotResult, SnapshotStateOptions } from './types'
41import type { RawSnapshotInfo } from './port/rawSnapshot'
22+import type { SnapshotResult, SnapshotStateOptions } from './types'
33+import SnapshotState from './port/state'
44+import { deepMergeSnapshot } from './port/utils'
5566function createMismatchError(
77 message: string,
+5-5
packages/snapshot/src/index.ts
···11export { SnapshotClient } from './client'
2233-export { default as SnapshotState } from './port/state'
44-export { addSerializer, getSerializers } from './port/plugins'
53export { stripSnapshotIndentation } from './port/inlineSnapshot'
44+export { addSerializer, getSerializers } from './port/plugins'
55+export { default as SnapshotState } from './port/state'
6677export type {
88 SnapshotData,
99- SnapshotUpdateState,
1010- SnapshotStateOptions,
119 SnapshotMatchOptions,
1210 SnapshotResult,
1311 SnapshotSerializer,
1414- UncheckedSnapshot,
1212+ SnapshotStateOptions,
1513 SnapshotSummary,
1414+ SnapshotUpdateState,
1515+ UncheckedSnapshot,
1616} from './types'
+1-1
packages/snapshot/src/manager.ts
···11-import { basename, dirname, isAbsolute, join, resolve } from 'pathe'
21import type {
32 SnapshotResult,
43 SnapshotStateOptions,
54 SnapshotSummary,
65} from './types'
66+import { basename, dirname, isAbsolute, join, resolve } from 'pathe'
7788export class SnapshotManager {
99 summary: SnapshotSummary = undefined!
+2-2
packages/ui/client/global-setup.ts
···11/// <reference types="vite-plugin-pages/client" />
2233+import FloatingVue, { VTooltip } from 'floating-vue'
44+import routes from 'virtual:generated-pages'
35import {
46 createRouter as _createRouter,
57 createWebHashHistory,
68} from 'vue-router'
77-import FloatingVue, { VTooltip } from 'floating-vue'
88-import routes from 'virtual:generated-pages'
99import 'd3-graph-controller/default.css'
1010import 'splitpanes/dist/splitpanes.css'
1111import '@unocss/reset/tailwind.css'
+2-2
packages/ui/client/test.ts
···11import {
22- type RenderOptions,
32 render as _render,
43 cleanup,
44+ type RenderOptions,
55} from '@testing-library/vue'
66import { VTooltip } from 'floating-vue'
77import { afterEach } from 'vitest'
···2121 cleanup()
2222})
23232424-export { within, screen } from '@testing-library/vue'
2424+export { screen, within } from '@testing-library/vue'
+4-4
packages/ui/node/index.ts
···11+import type { Plugin } from 'vite'
22+import type { Vitest } from 'vitest/node'
13import { fileURLToPath } from 'node:url'
44+import { toArray } from '@vitest/utils'
25import { basename, resolve } from 'pathe'
36import sirv from 'sirv'
44-import type { Plugin } from 'vite'
55-import { coverageConfigDefaults } from 'vitest/config'
66-import type { Vitest } from 'vitest/node'
77-import { toArray } from '@vitest/utils'
87import c from 'tinyrainbow'
88+import { coverageConfigDefaults } from 'vitest/config'
99import { version } from '../package.json'
10101111export default (ctx: Vitest): Plugin => {
+8-8
packages/ui/node/reporter.ts
···11-import { promises as fs } from 'node:fs'
22-import { fileURLToPath } from 'node:url'
33-import { promisify } from 'node:util'
44-import { gzip, constants as zlibConstants } from 'node:zlib'
55-import { basename, dirname, relative, resolve } from 'pathe'
66-import { globSync } from 'tinyglobby'
77-import c from 'tinyrainbow'
88-import { stringify } from 'flatted'
91import type {
102 File,
113 ModuleGraphData,
···146 Vitest,
157} from 'vitest'
168import type { HTMLOptions } from 'vitest/node'
99+import { promises as fs } from 'node:fs'
1010+import { fileURLToPath } from 'node:url'
1111+import { promisify } from 'node:util'
1212+import { gzip, constants as zlibConstants } from 'node:zlib'
1313+import { stringify } from 'flatted'
1414+import { basename, dirname, relative, resolve } from 'pathe'
1515+import { globSync } from 'tinyglobby'
1616+import c from 'tinyrainbow'
1717import { getModuleGraph } from '../../vitest/src/utils/graph'
18181919interface PotentialConfig {
+2-2
packages/utils/src/display.ts
···11-// since this is already part of Vitest via Chai, we can just reuse it without increasing the size of bundle
22-import * as loupe from 'loupe'
31import type { PrettyFormatOptions } from '@vitest/pretty-format'
42import {
53 format as prettyFormat,
64 plugins as prettyFormatPlugins,
75} from '@vitest/pretty-format'
66+// since this is already part of Vitest via Chai, we can just reuse it without increasing the size of bundle
77+import * as loupe from 'loupe'
8899type Inspect = (value: unknown, options: Options) => string
1010interface Options {
+1-1
packages/utils/src/error.ts
···11+import type { TestError } from './types'
12import { type DiffOptions, printDiffOrStringify } from './diff'
23import { format, stringify } from './display'
33-import type { TestError } from './types'
4455// utils is bundled for any environment and might not support `Element`
66declare class Element {
+1-1
packages/utils/src/highlight.ts
···11-import { type TokenColors, highlight as baseHighlight } from 'tinyhighlight'
11+import { highlight as baseHighlight, type TokenColors } from 'tinyhighlight'
22import c, { type Colors } from 'tinyrainbow'
3344function getDefs(c: Colors): TokenColors {
+40-40
packages/utils/src/index.ts
···11export {
22- notNullish,
33- assertTypes,
44- isPrimitive,
55- slash,
66- parseRegexp,
77- isObject,
88- getType,
99- getOwnProperties,
1010- deepClone,
1111- clone,
1212- noop,
1313- objectAttr,
1414- createDefer,
1515- getCallLastIndex,
1616- isNegativeNaN,
1717- createSimpleStackTrace,
1818- toArray,
1919- deepMerge,
2020-} from './helpers'
2121-export type { DeferPromise } from './helpers'
2222-2323-export { getSafeTimers, setSafeTimers } from './timers'
2424-export type { SafeTimers } from './timers'
2525-2626-export { shuffle } from './random'
2727-export {
2828- stringify,
292 format,
303 inspect,
314 objDisplay,
55+ stringify,
326} from './display'
337export type { StringifyOptions } from './display'
88+349export {
3535- positionToOffset,
3636- offsetToLineNumber,
3737- lineSplitRE,
3838-} from './offset'
1010+ assertTypes,
1111+ clone,
1212+ createDefer,
1313+ createSimpleStackTrace,
1414+ deepClone,
1515+ deepMerge,
1616+ getCallLastIndex,
1717+ getOwnProperties,
1818+ getType,
1919+ isNegativeNaN,
2020+ isObject,
2121+ isPrimitive,
2222+ noop,
2323+ notNullish,
2424+ objectAttr,
2525+ parseRegexp,
2626+ slash,
2727+ toArray,
2828+} from './helpers'
2929+export type { DeferPromise } from './helpers'
3030+3931export { highlight } from './highlight'
3232+export { nanoid } from './nanoid'
3333+export {
3434+ lineSplitRE,
3535+ offsetToLineNumber,
3636+ positionToOffset,
3737+} from './offset'
3838+export { shuffle } from './random'
3939+export { getSafeTimers, setSafeTimers } from './timers'
4040+4141+export type { SafeTimers } from './timers'
40424143export type {
4242- Awaitable,
4343- Nullable,
4444- Arrayable,
4544 ArgumentsType,
4646- MergeInsertions,
4747- DeepMerge,
4848- MutableArray,
4545+ Arrayable,
4646+ Awaitable,
4947 Constructable,
5050- ParsedStack,
4848+ DeepMerge,
5149 ErrorWithDiff,
5050+ MergeInsertions,
5151+ MutableArray,
5252+ Nullable,
5353+ ParsedStack,
5254 SerializedError,
5355 TestError,
5456} from './types'
5555-5656-export { nanoid } from './nanoid'
+4-4
packages/utils/src/source-map.ts
···11-import { resolve } from 'pathe'
21import type { SourceMapInput } from '@jridgewell/trace-mapping'
33-import { TraceMap, originalPositionFor } from '@jridgewell/trace-mapping'
42import type { ErrorWithDiff, ParsedStack } from './types'
33+import { originalPositionFor, TraceMap } from '@jridgewell/trace-mapping'
44+import { resolve } from 'pathe'
55import { isPrimitive, notNullish } from './helpers'
6677export {
88- TraceMap,
99- originalPositionFor,
108 generatedPositionFor,
99+ originalPositionFor,
1010+ TraceMap,
1111} from '@jridgewell/trace-mapping'
1212export type { SourceMapInput } from '@jridgewell/trace-mapping'
1313
+4-4
packages/vite-node/src/cli.ts
···11+import type { ViteNodeServerOptions } from './types'
12import { resolve } from 'node:path'
23import cac from 'cac'
34import c from 'tinyrainbow'
45import { createServer, loadEnv } from 'vite'
56import { version } from '../package.json'
66-import { ViteNodeServer } from './server'
77import { ViteNodeRunner } from './client'
88-import type { ViteNodeServerOptions } from './types'
99-import { toArray } from './utils'
108import { createHotContext, handleMessage, viteNodeHmrPlugin } from './hmr'
99+import { ViteNodeServer } from './server'
1110import { installSourcemapsSupport } from './source-map'
1111+import { toArray } from './utils'
12121313const cli = cac('vite-node')
1414···164164 }
165165166166 await waitForWatched(files)
167167- // eslint-disable-next-line no-console
167167+168168 console.log('[debug] watcher is ready')
169169 }
170170 }
+4-4
packages/vite-node/src/client.ts
···11-import { createRequire } from 'node:module'
11+import type { HotContext, ModuleCache, ViteNodeRunnerOptions } from './types'
2233+import { createRequire } from 'node:module'
34// we need native dirname, because windows __dirname has \\
45import { dirname } from 'node:path'
56import { fileURLToPath, pathToFileURL } from 'node:url'
67import vm from 'node:vm'
77-import { resolve } from 'pathe'
88import createDebug from 'debug'
99+import { resolve } from 'pathe'
1010+import { extractSourceMap } from './source-map'
911import {
1012 cleanUrl,
1113 createImportMetaEnvProxy,
···1719 slash,
1820 toFilePath,
1921} from './utils'
2020-import type { HotContext, ModuleCache, ViteNodeRunnerOptions } from './types'
2121-import { extractSourceMap } from './source-map'
22222323const { setTimeout, clearTimeout } = globalThis
2424
+2-2
packages/vite-node/src/debug.ts
···11+import type { TransformResult } from 'vite'
22+import type { DebuggerOptions } from './types'
13/* eslint-disable no-console */
24import { existsSync, promises as fs } from 'node:fs'
35import { join, resolve } from 'pathe'
44-import type { TransformResult } from 'vite'
56import c from 'tinyrainbow'
66-import type { DebuggerOptions } from './types'
7788function hashCode(s: string) {
99 return s.split('').reduce((a, b) => {
+2-2
packages/vite-node/src/externalize.ts
···11+import type { DepsHandlingOptions } from './types'
12import { existsSync, promises as fsp } from 'node:fs'
23import { dirname, extname, join } from 'pathe'
33-import type { DepsHandlingOptions } from './types'
44-import { findNearestPackageData, isNodeBuiltin, slash } from './utils'
54import { KNOWN_ASSET_RE } from './constants'
55+import { findNearestPackageData, isNodeBuiltin, slash } from './utils'
6677const BUILTIN_EXTENSIONS = new Set(['.mjs', '.cjs', '.node', '.wasm'])
88
+8-8
packages/vite-node/src/server.ts
···11-import { performance } from 'node:perf_hooks'
22-import { existsSync } from 'node:fs'
33-import assert from 'node:assert'
44-import { pathToFileURL } from 'node:url'
55-import { join, normalize, relative, resolve } from 'pathe'
61import type { TransformResult, ViteDevServer } from 'vite'
77-import createDebug from 'debug'
82import type {
93 DebuggerOptions,
104 EncodedSourceMap,
···126 ViteNodeResolveId,
137 ViteNodeServerOptions,
148} from './types'
99+import assert from 'node:assert'
1010+import { existsSync } from 'node:fs'
1111+import { performance } from 'node:perf_hooks'
1212+import { pathToFileURL } from 'node:url'
1313+import createDebug from 'debug'
1414+import { join, normalize, relative, resolve } from 'pathe'
1515+import { Debugger } from './debug'
1516import { shouldExternalize } from './externalize'
1717+import { withInlineSourcemap } from './source-map'
1618import {
1719 normalizeModuleId,
1820 toArray,
1921 toFilePath,
2022 withTrailingSlash,
2123} from './utils'
2222-import { Debugger } from './debug'
2323-import { withInlineSourcemap } from './source-map'
24242525export * from './externalize'
2626
+3-3
packages/vite-node/src/source-map-handler.ts
···33// we make a custom implementatin because we don't need some features from source-map-support,
44// like polyfilled Buffer, browser support, etc.
5566-import path from 'node:path'
77-import fs from 'node:fs'
86import type {
97 OriginalMapping,
108 SourceMapInput,
119} from '@jridgewell/trace-mapping'
1212-import { TraceMap, originalPositionFor } from '@jridgewell/trace-mapping'
1010+import fs from 'node:fs'
1111+import path from 'node:path'
1212+import { originalPositionFor, TraceMap } from '@jridgewell/trace-mapping'
13131414// Only install once if called multiple times
1515let errorFormatterInstalled = false
+3-3
packages/vite-node/src/source-map.ts
···11import type { TransformResult } from 'vite'
22-import { dirname, isAbsolute, relative, resolve } from 'pathe'
33-import { withTrailingSlash } from './utils'
44-import { install } from './source-map-handler'
52import type { EncodedSourceMap } from './types'
33+import { dirname, isAbsolute, relative, resolve } from 'pathe'
44+import { install } from './source-map-handler'
55+import { withTrailingSlash } from './utils'
6677interface InstallSourceMapSupportOptions {
88 getSourceMap: (source: string) => EncodedSourceMap | null | undefined
+2-2
packages/vite-node/src/types.ts
···11-import type { ViteHotContext } from 'vite/types/hot.js'
21import type { EncodedSourceMap } from '@jridgewell/trace-mapping'
22+import type { ViteHotContext } from 'vite/types/hot.js'
33import type { ModuleCacheMap, ViteNodeRunner } from './client'
4455export type Nullable<T> = T | null | undefined
···3333}
34343535export type {
3636- EncodedSourceMap,
3736 DecodedSourceMap,
3737+ EncodedSourceMap,
3838 SourceMapInput,
3939} from '@jridgewell/trace-mapping'
4040
+4-4
packages/vite-node/src/utils.ts
···11-import { fileURLToPath, pathToFileURL } from 'node:url'
22-import { builtinModules } from 'node:module'
33-import { existsSync, promises as fsp } from 'node:fs'
44-import { dirname, join, resolve } from 'pathe'
51import type { Arrayable, Nullable } from './types'
22+import { existsSync, promises as fsp } from 'node:fs'
33+import { builtinModules } from 'node:module'
44+import { fileURLToPath, pathToFileURL } from 'node:url'
55+import { dirname, join, resolve } from 'pathe'
6677export const isWindows = process.platform === 'win32'
88
+1-1
packages/vitest/src/defaults.ts
···11-import os from 'node:os'
21import type {
32 BenchmarkUserOptions,
43 CoverageV8Options,
54 ResolvedCoverageOptions,
65 UserConfig,
76} from './node/types/config'
77+import os from 'node:os'
88import { isCI } from './utils/env'
991010export { defaultBrowserPort } from './constants'
+2-2
packages/web-worker/src/pure.ts
···11-import { createWorkerConstructor } from './worker'
21import type { DefineWorkerOptions } from './types'
33-import { assertGlobalExists } from './utils'
42import { createSharedWorkerConstructor } from './shared-worker'
33+import { assertGlobalExists } from './utils'
44+import { createWorkerConstructor } from './worker'
5566export function defineWebWorkers(options?: DefineWorkerOptions) {
77 if (
+1-1
packages/web-worker/src/shared-worker.ts
···11+import type { Procedure } from './types'
12import {
23 MessageChannel,
34 type MessagePort as NodeMessagePort,
45} from 'node:worker_threads'
55-import type { Procedure } from './types'
66import { InlineWorkerRunner } from './runner'
77import { debug, getFileIdFromUrl, getRunnerOptions } from './utils'
88
+2-2
packages/web-worker/src/utils.ts
···11-import { readFileSync as _readFileSync } from 'node:fs'
21import type { WorkerGlobalState } from 'vitest'
22+import type { CloneOption } from './types'
33+import { readFileSync as _readFileSync } from 'node:fs'
34import ponyfillStructuredClone from '@ungap/structured-clone'
45import createDebug from 'debug'
55-import type { CloneOption } from './types'
6677// keep the reference in case it was mocked
88const readFileSync = _readFileSync
+1-1
packages/ws-client/src/index.ts
···66import type { WebSocketEvents, WebSocketHandlers } from 'vitest'
77import { StateManager } from './state'
8899-export * from '@vitest/runner/utils'
109export * from '../../vitest/src/utils/tasks'
1010+export * from '@vitest/runner/utils'
11111212export interface VitestClientOptions {
1313 handlers?: Partial<WebSocketEvents>
+3-3
test/benchmark/test/basic.test.ts
···11-import fs from 'node:fs'
22-import { expect, it } from 'vitest'
33-import * as pathe from 'pathe'
41import type { FormattedBenchmarkReport } from 'vitest/src/node/reporters/benchmark/table/index.js'
22+import fs from 'node:fs'
33+import * as pathe from 'pathe'
44+import { expect, it } from 'vitest'
55import { runVitest } from '../../test-utils'
6677it('basic', { timeout: 60_000 }, async () => {
+1-1
test/benchmark/test/reporter.test.ts
···11-import { assert, expect, it } from 'vitest'
21import * as pathe from 'pathe'
22+import { assert, expect, it } from 'vitest'
33import { runVitest } from '../../test-utils'
4455it('summary', async () => {
+1-1
test/benchmark/test/sequential.test.ts
···11import fs from 'node:fs'
22-import { expect, it } from 'vitest'
32import * as pathe from 'pathe'
33+import { expect, it } from 'vitest'
44import { runVitest } from '../../test-utils'
5566it('sequential', async () => {
+1-1
test/browser/test/cjs-lib.test.ts
···11-import { expect, test } from 'vitest'
21import cjsDefault, { a as cjsNamed } from '@vitest/cjs-lib'
32import * as cjsNamespace from '@vitest/cjs-lib'
33+import { expect, test } from 'vitest'
4455test('cjs namespace import', () => {
66 expect(cjsNamespace).toEqual({
+2-2
test/browser/test/dom.test.ts
···11-import { beforeEach, describe, expect, test } from 'vitest'
22-import { page } from '@vitest/browser/context'
31import { createNode } from '#src/createNode'
22+import { page } from '@vitest/browser/context'
33+import { beforeEach, describe, expect, test } from 'vitest'
44import '../src/button.css'
5566describe('dom related activity', () => {
+1-1
test/browser/test/userEvent.test.ts
···11-import { beforeEach, describe, expect, test, vi } from 'vitest'
21import { userEvent as _uE, server } from '@vitest/browser/context'
22+import { beforeEach, describe, expect, test, vi } from 'vitest'
33import '../src/button.css'
4455beforeEach(() => {
+3-3
test/browser/test/utils.test.ts
···11-import { inspect } from 'vitest/utils'
22-import { afterEach, expect, it, test } from 'vitest'
31import { commands } from '@vitest/browser/context'
44-52import { prettyDOM } from '@vitest/browser/utils'
33+import { afterEach, expect, it, test } from 'vitest'
44+55+import { inspect } from 'vitest/utils'
6677afterEach(() => {
88 document.body.innerHTML = ''
+1-1
test/cli/test/console.test.ts
···11+import { resolve } from 'pathe'
12import { expect, test } from 'vitest'
23import { DefaultReporter } from 'vitest/reporters'
33-import { resolve } from 'pathe'
44import { runVitest } from '../../test-utils'
5566test('can run custom pools with Vitest', async () => {
+1-1
test/cli/test/expect-soft.test.ts
···11-import { resolve } from 'node:path'
21import type { UserConfig } from 'vitest'
22+import { resolve } from 'node:path'
33import { describe, expect, test } from 'vitest'
44import { getCurrentTest } from 'vitest/suite'
55import { runVitest } from '../../test-utils'
···11-import { expect, it } from 'vitest'
21import type { File, TaskResultPack, UserConfig } from 'vitest'
32import { resolve } from 'pathe'
33+import { expect, it } from 'vitest'
44import { runVitest } from '../../test-utils'
5566it.each([
+4-4
test/cli/test/reported-tasks.test.ts
···11-import { beforeAll, expect, it } from 'vitest'
22-import { resolve } from 'pathe'
31import type { RunnerTestFile } from 'vitest'
44-import type { StateManager } from 'vitest/src/node/state.js'
52import type { WorkspaceProject } from 'vitest/node'
66-import { runVitest } from '../../test-utils'
33+import type { StateManager } from 'vitest/src/node/state.js'
74import type { TestCase, TestCollection, TestModule } from '../../../packages/vitest/src/node/reporters/reported-tasks'
55+import { resolve } from 'pathe'
66+import { beforeAll, expect, it } from 'vitest'
77+import { runVitest } from '../../test-utils'
8899const now = new Date()
1010// const finishedFiles: File[] = []
+2-2
test/config/test/bail.test.ts
···11-import { expect, test } from 'vitest'
22-31import type { UserConfig } from 'vitest/node'
22+33+import { expect, test } from 'vitest'
44import { runVitest } from '../../test-utils'
5566const configs: UserConfig[] = []
+1-1
test/config/test/cache.test.ts
···11-import { describe, expect, test } from 'vitest'
21import { resolve } from 'pathe'
22+import { describe, expect, test } from 'vitest'
33import { runVitest } from '../../test-utils'
4455const root = resolve(__dirname, '../fixtures/cache')
+1-1
test/config/test/console-color.test.ts
···11-import { expect, test } from 'vitest'
21import { x } from 'tinyexec'
22+import { expect, test } from 'vitest'
3344// use "x" directly since "runVitestCli" strips color
55
+1-1
test/config/test/exec-args.test.ts
···11-import { expect, test } from 'vitest'
21import { x } from 'tinyexec'
22+import { expect, test } from 'vitest'
33import { runVitest } from '../../test-utils'
4455const [nodeMajor, nodeMinor] = process.version.slice(1).split('.').map(Number)
+3-3
test/config/test/failures.test.ts
···11-import { beforeEach, expect, test } from 'vitest'
21import type { UserConfig } from 'vitest/node'
33-import { version } from 'vitest/package.json'
44-52import { normalize, resolve } from 'pathe'
33+import { beforeEach, expect, test } from 'vitest'
44+55+import { version } from 'vitest/package.json'
66import * as testUtils from '../../test-utils'
7788const providers = ['playwright', 'webdriverio', 'preview'] as const
+1-1
test/config/test/mixed-environments.test.ts
···11-import { expect, test } from 'vitest'
21import type { UserConfig } from 'vitest/node'
22+import { expect, test } from 'vitest'
3344import { runVitest } from '../../test-utils'
55
+2-2
test/config/test/override.test.ts
···11-import type { UserConfig } from 'vitest/node'
21import type { UserConfig as ViteUserConfig } from 'vite'
22+import type { UserConfig } from 'vitest/node'
33import { describe, expect, it } from 'vitest'
44-import { createVitest, parseCLI } from 'vitest/node'
54import { extraInlineDeps } from 'vitest/config'
55+import { createVitest, parseCLI } from 'vitest/node'
6677type VitestOptions = Parameters<typeof createVitest>[3]
88
+2-2
test/config/test/shard.test.ts
···11-import { expect, test } from 'vitest'
11+import type { UserConfig } from 'vitest/node'
22import { basename } from 'pathe'
3344-import type { UserConfig } from 'vitest/node'
44+import { expect, test } from 'vitest'
55import * as testUtils from '../../test-utils'
6677function runVitest(config: UserConfig) {
+1-1
test/config/test/workers-option.test.ts
···11-import { describe, expect, test, vi } from 'vitest'
21import type { UserConfig } from 'vitest/node'
22+import { describe, expect, test, vi } from 'vitest'
3344import { getWorkersCountByPercentage } from 'vitest/src/utils/workers.js'
55import * as testUtils from '../../test-utils'
+1-1
test/config/test/workspace.test.ts
···11-import { expect, it } from 'vitest'
21import { resolve } from 'pathe'
22+import { expect, it } from 'vitest'
33import { runVitest } from '../../test-utils'
4455it('correctly runs workspace tests when workspace config path is specified', async () => {
+1-1
test/core/__mocks__/zustand.ts
···11-import actualCreate from 'zustand'
21import { vi } from 'vitest'
22+import actualCreate from 'zustand'
3344// when creating a store, we get its initial state, create a reset function and add it in the set
55const create = vi.fn((createState) => {
+1-1
test/core/test/browserAutomocker.test.ts
···11+import { automockModule } from '@vitest/mocker/node'
12import { parseAst } from 'vite'
23import { expect, it } from 'vitest'
33-import { automockModule } from '@vitest/mocker/node'
4455function automock(code: string) {
66 return automockModule(code, 'automock', parseAst).toString()
+1-1
test/core/test/chainable.test.ts
···11-import { describe, expect, it } from 'vitest'
21import { createChainable } from '@vitest/runner/utils'
22+import { describe, expect, it } from 'vitest'
3344describe('chainable', () => {
55 it('creates', () => {
+2-2
test/core/test/cli-test.test.ts
···11-import { expect, test } from 'vitest'
21import { resolveConfig as viteResolveConfig } from 'vite'
33-import { resolveConfig } from '../../../packages/vitest/src/node/config/resolveConfig.js'
22+import { expect, test } from 'vitest'
43import { createCLI, parseCLI } from '../../../packages/vitest/src/node/cli/cac.js'
44+import { resolveConfig } from '../../../packages/vitest/src/node/config/resolveConfig.js'
5566const vitestCli = createCLI()
77
+1-1
test/core/test/custom.test.ts
···11-import { createChainable, getCurrentSuite } from 'vitest/suite'
21import {
32 afterAll,
43 afterEach,
···87 expect,
98 test,
109} from 'vitest'
1010+import { createChainable, getCurrentSuite } from 'vitest/suite'
1111import { Gardener } from '../src/custom/gardener.js'
12121313// this function will be called, when Vitest collects tasks
+3-3
test/core/test/diff.test.ts
···11-import { stripVTControlCharacters } from 'node:util'
22-import { expect, test, vi } from 'vitest'
31import type { DiffOptions } from '@vitest/utils/diff'
44-import { diff, diffStringsUnified, printDiffOrStringify } from '@vitest/utils/diff'
22+import { stripVTControlCharacters } from 'node:util'
53import { processError } from '@vitest/runner'
44+import { diff, diffStringsUnified, printDiffOrStringify } from '@vitest/utils/diff'
55+import { expect, test, vi } from 'vitest'
66import { displayDiff } from '../../../packages/vitest/src/node/error'
7788test('displays string diff', () => {
+1-1
test/core/test/expect.test.ts
···11-import nodeAssert from 'node:assert'
21import type { Tester } from '@vitest/expect'
22+import nodeAssert from 'node:assert'
33import { getCurrentTest } from '@vitest/runner'
44import { assert, describe, expect, expectTypeOf, test, vi } from 'vitest'
55
+1-1
test/core/test/immutable.test.ts
···11-import { expect, test } from 'vitest'
21import im from 'immutable'
22+import { expect, test } from 'vitest'
3344test('basic', () => {
55 expect(im.List([{ x: 1 }])).toEqual(im.List([{ x: 1 }]))
+1-1
test/core/test/injector-mock.test.ts
···11+import type { HoistMocksPluginOptions } from '../../../packages/mocker/src/node/hoistMocksPlugin'
12import { stripVTControlCharacters } from 'node:util'
23import { parseAst } from 'rollup/parseAst'
34import { describe, expect, it, test } from 'vitest'
45import { generateCodeFrame } from 'vitest/src/node/error.js'
55-import type { HoistMocksPluginOptions } from '../../../packages/mocker/src/node/hoistMocksPlugin'
66import { hoistMocks } from '../../../packages/mocker/src/node/hoistMocksPlugin'
7788function parse(code: string, options: any) {
+1-1
test/core/test/jest-expect.test.ts
···11/* eslint-disable no-sparse-arrays */
22import { AssertionError } from 'node:assert'
33import { stripVTControlCharacters } from 'node:util'
44-import { describe, expect, it, vi } from 'vitest'
54import { generateToBeMessage } from '@vitest/expect'
65import { processError } from '@vitest/utils/error'
66+import { describe, expect, it, vi } from 'vitest'
7788class TestError extends Error {}
99
+1-1
test/core/test/mock-fs.test.ts
···11+import { fs, vol } from 'memfs'
12// hello-world.test.js
23import { beforeEach, expect, it, vi } from 'vitest'
33-import { fs, vol } from 'memfs'
44import { readHelloWorld } from '../src/read-hello-world'
5566// tell vitest to use fs mock from __mocks__ folder
+2-2
test/core/test/mock-internals.test.ts
···11import childProcess, { exec } from 'node:child_process'
22import timers from 'node:timers'
33-import { type MockInstance, afterEach, beforeEach, describe, expect, test, vi } from 'vitest'
44-import { execDefault, execHelloWorld, execImportAll } from '../src/exec'
33+import { afterEach, beforeEach, describe, expect, type MockInstance, test, vi } from 'vitest'
54import { dynamicImport } from '../src/dynamic-import'
55+import { execDefault, execHelloWorld, execImportAll } from '../src/exec'
6677vi.mock('child_process')
88vi.mock('timers') // node built in inside __mocks__
+1-1
test/core/test/mocked-circular.test.ts
···11import { expect, it, vi } from 'vitest'
2233+import { circularA } from '../src/circularA'
34// The order of the two imports here matters: B before A
45import { circularB } from '../src/circularB'
55-import { circularA } from '../src/circularA'
6677vi.mock('../src/circularB')
88
+1-1
test/core/test/mocked-import-circular.test.ts
···11import { expect, it, vi } from 'vitest'
2233+import { circularA } from '../src/circularA'
34// The order of the two imports here matters: B before A
45import { circularB } from '../src/circularB'
55-import { circularA } from '../src/circularA'
6677vi.mock(import('../src/circularB'))
88
+3-3
test/core/test/mocked.test.ts
···22import { assert, describe, expect, test, vi, vitest } from 'vitest'
33// @ts-expect-error not typed module
44import { value as virtualValue } from 'virtual-module'
55-import { two } from '../src/submodule'
55+import * as globalMock from '../src/global-mock'
66import * as mocked from '../src/mockedA'
77import { mockedB } from '../src/mockedB'
88-import { MockedC, asyncFunc, exportedStream } from '../src/mockedC'
88+import { asyncFunc, exportedStream, MockedC } from '../src/mockedC'
99import MockedDefault, { MockedC as MockedD } from '../src/mockedD'
1010-import * as globalMock from '../src/global-mock'
1010+import { two } from '../src/submodule'
11111212vitest.mock('../src/submodule')
1313vitest.mock('virtual-module', () => ({ value: 'mock' }))
+2-2
test/core/test/module.test.ts
···2121// @ts-expect-error is not typed with imports
2222import * as classCjs from '../src/cjs/class-cjs'
23232424+import format from '../src/cjs/default-function'
2525+2426// @ts-expect-error is not typed with imports
2527import * as nestedDefaultCjs from '../src/cjs/nested-default-cjs'
2626-2727-import format from '../src/cjs/default-function'
28282929// @ts-expect-error is not typed with imports
3030import * as nestedDefaultExternalCjs from '../src/external/nested-default-cjs'
+1-1
test/core/test/node-protocol-jsdom.spec.ts
···11// @vitest-environment jsdom
2233+import nodeUrl from 'node:url'
34// outdated url package, which Vite will resolve to, if "url" import is used
45// this should help catch bugs in source code
56// eslint-disable-next-line unicorn/prefer-node-protocol
67import packageUrl from 'url'
77-import nodeUrl from 'node:url'
88import { expect, it } from 'vitest'
991010it('vitest resolves url to installed url package, but node:url to internal Node module', () => {
+1-1
test/core/test/node-protocol-node.spec.ts
···11// @vitest-environment node
2233+import nodeUrl from 'node:url'
34// eslint-disable-next-line unicorn/prefer-node-protocol
45import packageUrl from 'url'
55-import nodeUrl from 'node:url'
66import { expect, it } from 'vitest'
7788it('vitest resolves both "url" and "node:url" to internal URL module in Node environment', () => {
+1-1
test/core/test/resolve-ssr.test.ts
···11// @vitest-environment node
2233import { expect, test } from 'vitest'
44-import pkgNode from '../src/external/pkg-node'
54import pkgBrowser from '../src/external/pkg-browser'
55+import pkgNode from '../src/external/pkg-node'
6677test('[ssr] resolves to ssr, when node is first in conditions', () => {
88 expect(pkgNode).toBe('ssr')
+1-1
test/core/test/resolve-web.test.ts
···11// @vitest-environment happy-dom
2233import { expect, test } from 'vitest'
44-import pkgNode from '../src/external/pkg-node'
54import pkgBrowser from '../src/external/pkg-browser'
55+import pkgNode from '../src/external/pkg-node'
6677test('[web] resolves to ssr, when node is first in conditions', () => {
88 expect(pkgNode).toBe('ssr')
+4-4
test/core/test/sequencers.test.ts
···11import type { Vitest, WorkspaceProject } from 'vitest/node'
22-import { describe, expect, test, vi } from 'vitest'
33-import { RandomSequencer } from '../../../packages/vitest/src/node/sequencers/RandomSequencer'
44-import { BaseSequencer } from '../../../packages/vitest/src/node/sequencers/BaseSequencer'
55-import { TestSpecification } from '../../../packages/vitest/src/node/spec'
62import type { WorkspaceSpec as DeprecatedWorkspaceSpec } from '../../../packages/vitest/src/node/pool'
33+import { describe, expect, test, vi } from 'vitest'
44+import { BaseSequencer } from '../../../packages/vitest/src/node/sequencers/BaseSequencer'
55+import { RandomSequencer } from '../../../packages/vitest/src/node/sequencers/RandomSequencer'
66+import { TestSpecification } from '../../../packages/vitest/src/node/spec'
7788function buildCtx() {
99 return {
+1-1
test/core/test/utils-display.spec.ts
···11import util from 'node:util'
22-import { describe, expect, test } from 'vitest'
32import { format } from '@vitest/utils'
33+import { describe, expect, test } from 'vitest'
4455describe('format', () => {
66 const obj = {} as any
+4-4
test/core/test/utils.spec.ts
···11-import { beforeAll, describe, expect, test } from 'vitest'
22-import { assertTypes, deepClone, deepMerge, isNegativeNaN, objDisplay, objectAttr, toArray } from '@vitest/utils'
33-import { resetModules } from '../../../packages/vitest/src/runtime/utils'
44-import { deepMergeSnapshot } from '../../../packages/snapshot/src/port/utils'
51import type { EncodedSourceMap } from '../../../packages/vite-node/src/types'
22+import { assertTypes, deepClone, deepMerge, isNegativeNaN, objDisplay, objectAttr, toArray } from '@vitest/utils'
33+import { beforeAll, describe, expect, test } from 'vitest'
44+import { deepMergeSnapshot } from '../../../packages/snapshot/src/port/utils'
65import { ModuleCacheMap } from '../../../packages/vite-node/src/client'
66+import { resetModules } from '../../../packages/vitest/src/runtime/utils'
7788describe('assertTypes', () => {
99 test('the type of value should be number', () => {
+1-1
test/core/test/vi.spec.ts
···22 * @vitest-environment jsdom
33 */
4455-import type { Mock, MockInstance, MockedFunction, MockedObject } from 'vitest'
55+import type { Mock, MockedFunction, MockedObject, MockInstance } from 'vitest'
66import { describe, expect, expectTypeOf, test, vi } from 'vitest'
77import { getWorkerState } from '../../../packages/vitest/src/runtime/utils'
88
+2-2
test/core/test/web-worker-jsdom.test.ts
···11// @vitest-environment jsdom
2233-import '@vitest/web-worker'
44-53import { expect, it } from 'vitest'
44+65import GlobalsWorker from '../src/web-worker/worker-globals?worker'
66+import '@vitest/web-worker'
7788it('worker with invalid url throws an error', async () => {
99 const url = import.meta.url
+1-1
test/core/test/web-worker-mock.test.ts
···11-import '@vitest/web-worker'
21import { expect, test, vi } from 'vitest'
32import { workerDep } from '../src/web-worker/mock/worker-dep'
33+import '@vitest/web-worker'
4455vi.mock(import('../src/web-worker/mock/worker-dep'), () => ({ workerDep: () => 'mocked' }))
66
+5-5
test/core/test/web-worker-node.test.ts
···11// @vitest-environment node
2233-import '@vitest/web-worker'
44-53import { version } from 'node:process'
66-import { beforeEach, describe, expect, it, vi } from 'vitest'
7488-import MyWorker from '../src/web-worker/worker?worker'
99-import MyObjectWorker from '../src/web-worker/objectWorker?worker'
55+import { beforeEach, describe, expect, it, vi } from 'vitest'
106import MyEventListenerWorker from '../src/web-worker/eventListenerWorker?worker'
77+88+import MyObjectWorker from '../src/web-worker/objectWorker?worker'
119import MySelfWorker from '../src/web-worker/selfWorker?worker'
1210import MySharedWorker from '../src/web-worker/sharedWorker?sharedworker'
1111+import MyWorker from '../src/web-worker/worker?worker'
1312import GlobalsWorker from '../src/web-worker/worker-globals?worker'
1313+import '@vitest/web-worker'
14141515const major = Number(version.split('.')[0].slice(1))
1616
+1-1
test/core/vitest-environment-custom/index.ts
···11+import type { Environment } from 'vitest'
12import vm from 'node:vm'
23import debug from 'debug'
33-import type { Environment } from 'vitest'
4455// test that external packages (debug) are loaded correctly
66const log = debug('test:env')
+1-1
test/coverage-test/test/bundled-sources.test.ts
···11import libCoverage from 'istanbul-lib-coverage'
22import { expect } from 'vitest'
33-import { coverageTest, isV8Provider, normalizeURL, readCoverageJson, runVitest, test } from '../utils.js'
43import * as transpiled from '../fixtures/src/pre-bundle/bundle.js'
44+import { coverageTest, isV8Provider, normalizeURL, readCoverageJson, runVitest, test } from '../utils.js'
5566test('bundled code with source maps to originals', async () => {
77 await runVitest({
···11-import { assertType, test } from 'vitest'
21import type { CoverageProviderModule, ResolvedCoverageOptions, Vitest } from 'vitest'
32import type { defineConfig } from 'vitest/config'
33+import { assertType, test } from 'vitest'
4455type NarrowToTestConfig<T> = T extends { test?: any } ? NonNullable<T['test']> : never
66type Configuration = NarrowToTestConfig<(Parameters<typeof defineConfig>[0])>
+2-2
test/coverage-test/test/custom-reporter.test.ts
···11-import { readFileSync, readdirSync } from 'node:fs'
11+import { readdirSync, readFileSync } from 'node:fs'
22import { resolve } from 'node:path'
33import { expect } from 'vitest'
44-import { coverageTest, normalizeURL, runVitest, test } from '../utils'
54import { sum } from '../fixtures/src/math'
55+import { coverageTest, normalizeURL, runVitest, test } from '../utils'
6677test('custom reporter', async () => {
88 await runVitest({
+1-1
test/coverage-test/test/decorators.test.ts
···11import { expect } from 'vitest'
22-import { coverageTest, isV8Provider, normalizeURL, readCoverageMap, runVitest, test } from '../utils'
32import { DecoratorsTester } from '../fixtures/src/decorators'
33+import { coverageTest, isV8Provider, normalizeURL, readCoverageMap, runVitest, test } from '../utils'
4455test('decorators generated metadata is ignored', async () => {
66 await runVitest({
+1-1
test/coverage-test/test/dynamic-files.test.ts
···11import { expect } from 'vitest'
22-import { coverageTest, isV8Provider, normalizeURL, readCoverageMap, runVitest, test } from '../utils'
32import { runDynamicFileCJS, runDynamicFileESM } from '../fixtures/src/dynamic-files'
33+import { coverageTest, isV8Provider, normalizeURL, readCoverageMap, runVitest, test } from '../utils'
4455test('does not crash when files are created and removed during test run (#3657)', async () => {
66 await runVitest({
···11import { expect } from 'vitest'
22-import { coverageTest, normalizeURL, readCoverageMap, runVitest, test } from '../utils.js'
32import * as transpiled from '../fixtures/src/pre-bundle/bundle.js'
33+import { coverageTest, normalizeURL, readCoverageMap, runVitest, test } from '../utils.js'
4455test('{ excludeAfterRemap: true } should exclude files that come up after remapping', async () => {
66 await runVitest({
···11import { expect } from 'vitest'
22-import { coverageTest, normalizeURL, readCoverageMap, runVitest, test } from '../utils'
32import { implicitElse } from '../fixtures/src/implicit-else'
33+import { coverageTest, normalizeURL, readCoverageMap, runVitest, test } from '../utils'
4455test('implicit else is included in branch count', async () => {
66 await runVitest({
+1-1
test/coverage-test/test/import-meta-env.test.ts
···11import { expect } from 'vitest'
22-import { coverageTest, normalizeURL, readCoverageMap, runVitest, test } from '../utils'
32import { useImportEnv } from '../fixtures/src/import-meta-env'
33+import { coverageTest, normalizeURL, readCoverageMap, runVitest, test } from '../utils'
4455test('file using import.meta.env is included in report (#2332)', async () => {
66 await runVitest(
···11import { stripVTControlCharacters } from 'node:util'
22-import { expect, test, vi } from 'vitest'
33-import { configDefaults } from 'vitest/config'
22+import IstanbulProvider from '@vitest/coverage-istanbul'
43import V8Provider from '@vitest/coverage-v8'
54import packageJson from '@vitest/coverage-v8/package.json'
66-import IstanbulProvider from '@vitest/coverage-istanbul'
55+import { expect, test, vi } from 'vitest'
66+import { configDefaults } from 'vitest/config'
7788const version = packageJson.version
99
+1-1
test/coverage-test/test/on-failure.test.ts
···11import { expect } from 'vitest'
22-import { captureStdout, coverageTest, isV8Provider, normalizeURL, runVitest, test } from '../utils'
32import { sum } from '../fixtures/src/math'
33+import { captureStdout, coverageTest, isV8Provider, normalizeURL, runVitest, test } from '../utils'
4455test('report is not generated when tests fail', async () => {
66 const stdout = captureStdout()
···11-import { parseModule } from 'magicast'
21import type { CoverageMap } from 'istanbul-lib-coverage'
32import { createCoverageSummary } from 'istanbul-lib-coverage'
33+import { parseModule } from 'magicast'
4455import { expect, test } from 'vitest'
66import { defineConfig } from 'vitest/config'
+1-1
test/coverage-test/test/threshold-failure.test.ts
···11import { expect } from 'vitest'
22-import { coverageTest, isV8Provider, normalizeURL, runVitest, test } from '../utils'
32import { sum } from '../fixtures/src/math'
33+import { coverageTest, isV8Provider, normalizeURL, runVitest, test } from '../utils'
4455test('failing thresholds', async () => {
66 const { exitCode, stderr } = await runVitest({
+2-2
test/coverage-test/test/threshold-glob.test.ts
···11import { expect } from 'vitest'
22-import { coverageTest, isV8Provider, normalizeURL, runVitest, test } from '../utils'
33-import { sum } from '../fixtures/src/math'
42import { isEven, isOdd } from '../fixtures/src/even'
33+import { sum } from '../fixtures/src/math'
44+import { coverageTest, isV8Provider, normalizeURL, runVitest, test } from '../utils'
5566test('threshold glob patterns count in global coverage', async () => {
77 await runVitest({
+1-1
test/coverage-test/test/vue.test.ts
···11-import { resolve } from 'node:path'
21import { readdirSync } from 'node:fs'
22+import { resolve } from 'node:path'
33import { beforeAll, expect } from 'vitest'
44import { isBrowser, isV8Provider, readCoverageMap, runVitest, test } from '../utils'
55
···11-import { createServer } from 'vite'
21import { resolve } from 'pathe'
22+import { createServer } from 'vite'
3344let teardownHappened = false
55
+3-3
test/public-mocker/test/mocker.test.ts
···11-import { mockerPlugin } from '@vitest/mocker/node'
11+import type { Browser } from 'playwright'
22import type { UserConfig } from 'vite'
33+import { mockerPlugin } from '@vitest/mocker/node'
44+import { chromium } from 'playwright'
35import { createServer } from 'vite'
46import { beforeAll, expect, it, onTestFinished } from 'vitest'
55-import type { Browser } from 'playwright'
66-import { chromium } from 'playwright'
7788let browser: Browser
99beforeAll(async () => {
+2-2
test/reporters/src/context.ts
···11import type { ModuleGraph, ViteDevServer } from 'vite'
22-import type { Logger } from '../../../packages/vitest/src/node/logger'
32import type { Vitest } from '../../../packages/vitest/src/node/core'
44-import type { File } from '../../../packages/vitest/src/public/index'
33+import type { Logger } from '../../../packages/vitest/src/node/logger'
54import type { StateManager } from '../../../packages/vitest/src/node/state'
65import type { ResolvedConfig } from '../../../packages/vitest/src/node/types/config'
66+import type { File } from '../../../packages/vitest/src/public/index'
7788interface Context {
99 vitest: Vitest
···11-import { assertType, test } from 'vitest'
21import type { defineConfig } from 'vitest/config'
22+import { assertType, test } from 'vitest'
3344type NarrowToTestConfig<T> = T extends { test?: any } ? NonNullable<T['test']> : never
55type Configuration = NonNullable<NarrowToTestConfig<(Parameters<typeof defineConfig>[0])>>
+2-2
test/reporters/tests/console.test.ts
···11-import { resolve } from 'pathe'
22-import { type UserConsoleLog, expect, test } from 'vitest'
31import type { Reporter } from 'vitest/reporters'
22+import { resolve } from 'pathe'
33+import { expect, test, type UserConsoleLog } from 'vitest'
44import { DefaultReporter } from 'vitest/reporters'
55import { runVitest } from '../../test-utils'
66
+1-1
test/reporters/tests/custom-diff-config.spec.ts
···11-import { expect, test } from 'vitest'
21import { resolve } from 'pathe'
22+import { expect, test } from 'vitest'
33import { runVitest } from '../../test-utils'
4455test('custom diff config', async () => {
+1-1
test/reporters/tests/custom-reporter.spec.ts
···11import { resolve } from 'pathe'
22import { describe, expect, test } from 'vitest'
3344-import TestReporter from '../src/custom-reporter'
54import { runVitest, runVitestCli } from '../../test-utils'
55+import TestReporter from '../src/custom-reporter'
6677const customTsReporterPath = resolve(__dirname, '../src/custom-reporter.ts')
88const customJSReporterPath = resolve(__dirname, '../src/custom-reporter.js')
+1-1
test/reporters/tests/function-as-name.test.ts
···11-import { expect, test } from 'vitest'
21import { resolve } from 'pathe'
22+import { expect, test } from 'vitest'
33import { runVitest } from '../../test-utils'
4455test('should print function name', async () => {
+1-1
test/reporters/tests/github-actions.test.ts
···11import { resolve } from 'pathe'
22import { expect, test } from 'vitest'
33-import { runVitest } from '../../test-utils'
43import { GithubActionsReporter } from '../../../packages/vitest/src/node/reporters'
44+import { runVitest } from '../../test-utils'
5566test(GithubActionsReporter, async () => {
77 let { stdout, stderr } = await runVitest(
+2-2
test/reporters/tests/html.test.ts
···11import fs from 'node:fs'
22-import zlib from 'node:zlib'
32import { stripVTControlCharacters } from 'node:util'
33+import zlib from 'node:zlib'
44+import { parse } from 'flatted'
45import { resolve } from 'pathe'
56import { describe, expect, it } from 'vitest'
66-import { parse } from 'flatted'
7788import { runVitest } from '../../test-utils'
99
+1-1
test/reporters/tests/indicator-position.test.ts
···11import { readFileSync } from 'node:fs'
22-import { expect, test } from 'vitest'
32import { resolve } from 'pathe'
33+import { expect, test } from 'vitest'
44import { runVitest } from '../../test-utils'
5566test('should print correct indicator position', async () => {
+2-2
test/reporters/tests/junit.test.ts
···11import type { File, Suite, Task, TaskResult } from 'vitest'
22-import { expect, test } from 'vitest'
32import { resolve } from 'pathe'
44-import { runVitest } from '../../test-utils'
33+import { expect, test } from 'vitest'
54import { getDuration } from '../../../packages/vitest/src/node/reporters/junit'
55+import { runVitest } from '../../test-utils'
6677const root = resolve(__dirname, '../fixtures')
88
+1-1
test/reporters/tests/reporters.spec.ts
···11import { existsSync, readFileSync, rmSync } from 'node:fs'
22-import { beforeEach, expect, test, vi } from 'vitest'
32import { normalize, resolve } from 'pathe'
33+import { beforeEach, expect, test, vi } from 'vitest'
44import { JsonReporter } from '../../../packages/vitest/src/node/reporters/json'
55import { JUnitReporter } from '../../../packages/vitest/src/node/reporters/junit'
66import { TapReporter } from '../../../packages/vitest/src/node/reporters/tap'
+3-3
test/reporters/tests/utils.test.ts
···11+import type { ViteNodeRunner } from 'vite-node/client'
22+import type { Vitest } from 'vitest'
13/**
24 * @format
35 */
46import { resolve } from 'pathe'
55-import type { ViteNodeRunner } from 'vite-node/client'
66-import type { Vitest } from 'vitest'
77import { describe, expect, test } from 'vitest'
88-import { createReporters } from '../../../packages/vitest/src/node/reporters/utils'
98import { DefaultReporter } from '../../../packages/vitest/src/node/reporters/default'
99+import { createReporters } from '../../../packages/vitest/src/node/reporters/utils'
1010import TestReporter from '../src/custom-reporter'
11111212const customReporterPath = resolve(__dirname, '../src/custom-reporter.js')
+1-1
test/snapshots/test/custom-environment.test.ts
···11import { readFileSync, rmSync, writeFileSync } from 'node:fs'
22-import { afterEach, expect, test } from 'vitest'
32import { dirname, resolve } from 'pathe'
33+import { afterEach, expect, test } from 'vitest'
44import { runVitest } from '../../test-utils'
5566const testFileName = resolve(import.meta.dirname, './fixtures/custom-snapshot-environment/test/snapshots.test.ts')
+1-1
test/snapshots/test/snapshots.test.ts
···11import fs from 'node:fs/promises'
22-import { expect, test } from 'vitest'
32import pathe from 'pathe'
33+import { expect, test } from 'vitest'
4455import { editFile, runVitest } from '../../test-utils'
66
+1-1
test/ui/test/html-report.spec.ts
···11+import type { PreviewServer } from 'vite'
12import { Writable } from 'node:stream'
23import { expect, test } from '@playwright/test'
33-import type { PreviewServer } from 'vite'
44import { preview } from 'vite'
55import { startVitest } from 'vitest/node'
66
+1-1
test/ui/test/ui.spec.ts
···11import { Writable } from 'node:stream'
22import { expect, test } from '@playwright/test'
33-import { type Vitest, startVitest } from 'vitest/node'
33+import { startVitest, type Vitest } from 'vitest/node'
4455const port = 9000
66const pageUrl = `http://localhost:${port}/__vitest__/`
+1-1
test/vite-node/test/circular.test.ts
···11-import { expect, test } from 'vitest'
21import { resolve } from 'pathe'
22+import { expect, test } from 'vitest'
33import { runViteNodeCli } from '../../test-utils'
4455test('circular 1', async () => {
+1-1
test/vite-node/test/hmr.test.ts
···11-import { test } from 'vitest'
21import { resolve } from 'pathe'
22+import { test } from 'vitest'
33import { editFile, runViteNodeCli } from '../../test-utils'
4455test('hmr.accept works correctly', async () => {
+2-2
test/vite-node/test/self-export.test.ts
···11-import { expect, it } from 'vitest'
21import { resolve } from 'pathe'
33-import ansiEscapes, { HelloWorld } from '../src/self-export'
22+import { expect, it } from 'vitest'
43import { runViteNodeCli } from '../../test-utils'
44+import ansiEscapes, { HelloWorld } from '../src/self-export'
5566it('should export self', () => {
77 expect(ansiEscapes.HelloWorld).eq(HelloWorld)
+1-1
test/vite-node/test/server.test.ts
···11import { join, resolve } from 'pathe'
22+import { createServer, type Plugin, type ViteDevServer } from 'vite'
23import { ViteNodeServer } from 'vite-node/server'
34import { describe, expect, test, vi } from 'vitest'
44-import { type Plugin, type ViteDevServer, createServer } from 'vite'
55import { extractSourceMap } from '../../../packages/vite-node/src/source-map'
6677describe('server works correctly', async () => {
+1-1
test/vite-node/test/sourcemap.test.ts
···11+import type { SourceMap } from 'rollup'
12/* eslint-disable no-template-curly-in-string */
23import type { TransformResult } from 'vite'
34import { describe, expect, it } from 'vitest'
44-import type { SourceMap } from 'rollup'
55import { withInlineSourcemap } from '../../../packages/vite-node/src/source-map'
6677it('regex match', () => {
+1-1
test/watch/test/related.test.ts
···11-import { test } from 'vitest'
21import { resolve } from 'pathe'
22+import { test } from 'vitest'
33import { editFile, runVitest } from '../../test-utils'
4455test('when nothing is changed, run nothing but keep watching', async () => {
+2-2
test/watch/test/workspaces.test.ts
···11-import { fileURLToPath } from 'node:url'
21import { readFileSync, rmSync, writeFileSync } from 'node:fs'
33-import { afterAll, afterEach, expect, it } from 'vitest'
22+import { fileURLToPath } from 'node:url'
43import { dirname, resolve } from 'pathe'
44+import { afterAll, afterEach, expect, it } from 'vitest'
5566import { runVitestCli } from '../../test-utils'
77
···11import { existsSync, readFileSync } from 'node:fs'
22-import { expect, test } from 'vitest'
32import libCoverage from 'istanbul-lib-coverage'
43import { resolve } from 'pathe'
44+import { expect, test } from 'vitest'
5566test('coverage exists', () => {
77 expect(existsSync('./coverage')).toBe(true)
+1-1
test/workspaces/space-pools/isolate.test.ts
···11-import { expect, test } from 'vitest'
21import type { UserConfig } from 'vitest/config'
22+import { expect, test } from 'vitest'
3344test('is isolated', () => {
55 // @ts-expect-error -- internal
+1-1
test/workspaces/space-pools/multi-worker.test.ts
···11-import { expect, test } from 'vitest'
21import type { UserConfig } from 'vitest/config'
22+import { expect, test } from 'vitest'
3344test('is multi worker', () => {
55 // @ts-expect-error -- internal
+1-1
test/workspaces/space-pools/no-isolate.test.ts
···11-import { expect, test } from 'vitest'
21import type { UserConfig } from 'vitest/config'
22+import { expect, test } from 'vitest'
3344test('is not isolated', () => {
55 // @ts-expect-error -- internal
+1-1
test/workspaces/space-pools/single-worker.test.ts
···11-import { expect, test } from 'vitest'
21import type { UserConfig } from 'vitest/config'
22+import { expect, test } from 'vitest'
3344test('is single worker', () => {
55 // @ts-expect-error -- internal
+1-1
packages/browser/src/client/channel.ts
···11-import type { CancelReason } from '@vitest/runner'
21import type { MockedModuleSerialized } from '@vitest/mocker'
22+import type { CancelReason } from '@vitest/runner'
33import { getBrowserState } from './utils'
4455export interface IframeDoneEvent {
+1-1
packages/browser/src/client/client.ts
···11import type { CancelReason } from '@vitest/runner'
22+import type { WebSocketBrowserEvents, WebSocketBrowserHandlers } from '../node/types'
23import { type BirpcReturn, createBirpc } from 'birpc'
34import { parse, stringify } from 'flatted'
44-import type { WebSocketBrowserEvents, WebSocketBrowserHandlers } from '../node/types'
55import { getBrowserState } from './utils'
6677const PAGE_TYPE = getBrowserState().type
+6-6
packages/browser/src/client/orchestrator.ts
···11-import { channel, client } from '@vitest/browser/client'
22-import { generateHash } from '@vitest/runner/utils'
33-import { type GlobalChannelIncomingEvent, type IframeChannelEvent, type IframeChannelIncomingEvent, globalChannel } from '@vitest/browser/client'
44-import { relative } from 'pathe'
51import type { SerializedConfig } from 'vitest'
66-import { getBrowserState, getConfig } from './utils'
77-import { getUiAPI } from './ui'
22+import { channel, client } from '@vitest/browser/client'
33+import { globalChannel, type GlobalChannelIncomingEvent, type IframeChannelEvent, type IframeChannelIncomingEvent } from '@vitest/browser/client'
44+import { generateHash } from '@vitest/runner/utils'
55+import { relative } from 'pathe'
86import { createModuleMockerInterceptor } from './tester/msw'
77+import { getUiAPI } from './ui'
88+import { getBrowserState, getConfig } from './utils'
991010const url = new URL(location.href)
1111const ID_ALL = '__vitest_all__'
···11-import type { WorkspaceProject } from 'vitest/node'
21import type { Plugin } from 'vitest/config'
33-import { createViteLogger, createViteServer } from 'vitest/node'
22+import type { WorkspaceProject } from 'vitest/node'
43import c from 'tinyrainbow'
44+import { createViteLogger, createViteServer } from 'vitest/node'
55import { version } from '../../package.json'
66+import BrowserPlugin from './plugin'
67import { setupBrowserRpc } from './rpc'
78import { BrowserServer } from './server'
88-import BrowserPlugin from './plugin'
991010-export type { BrowserServer } from './server'
1110export { createBrowserPool } from './pool'
1111+export type { BrowserServer } from './server'
12121313export async function createBrowserServer(
1414 project: WorkspaceProject,
+10-10
packages/browser/src/node/plugin.ts
···11-import { fileURLToPath } from 'node:url'
22-import { createRequire } from 'node:module'
33-import { lstatSync, readFileSync } from 'node:fs'
41import type { Stats } from 'node:fs'
22+import type { WorkspaceProject } from 'vitest/node'
33+import type { BrowserServer } from './server'
44+import { lstatSync, readFileSync } from 'node:fs'
55+import { createRequire } from 'node:module'
66+import { fileURLToPath } from 'node:url'
77+import { dynamicImportPlugin } from '@vitest/mocker/node'
88+import { toArray } from '@vitest/utils'
99+import MagicString from 'magic-string'
510import { basename, dirname, extname, resolve } from 'pathe'
611import sirv from 'sirv'
77-import type { WorkspaceProject } from 'vitest/node'
1212+import { coverageConfigDefaults, type Plugin } from 'vitest/config'
813import { getFilePoolName, resolveApiServerConfig, resolveFsAllow, distDir as vitestDist } from 'vitest/node'
99-import { type Plugin, coverageConfigDefaults } from 'vitest/config'
1010-import { toArray } from '@vitest/utils'
1111-import { dynamicImportPlugin } from '@vitest/mocker/node'
1212-import MagicString from 'magic-string'
1314import BrowserContext from './plugins/pluginContext'
1414-import type { BrowserServer } from './server'
1515import { resolveOrchestrator } from './serverOrchestrator'
1616import { resolveTester } from './serverTester'
17171818-export type { BrowserCommand } from 'vitest/node'
1918export { defineBrowserCommand } from './commands/utils'
1919+export type { BrowserCommand } from 'vitest/node'
20202121export default (browserServer: BrowserServer, base = '/'): Plugin[] => {
2222 const pkgRoot = resolve(fileURLToPath(import.meta.url), '../..')
+3-3
packages/browser/src/node/pool.ts
···11-import * as nodeos from 'node:os'
22-import crypto from 'node:crypto'
33-import { relative } from 'pathe'
41import type { BrowserProvider, ProcessPool, Vitest, WorkspaceProject, WorkspaceSpec } from 'vitest/node'
22+import crypto from 'node:crypto'
33+import * as nodeos from 'node:os'
44+import { relative } from 'pathe'
55import { createDebugger } from 'vitest/node'
6677const debug = createDebugger('vitest:browser:pool')
+8-8
packages/browser/src/node/rpc.ts
···11+import type { ErrorWithDiff } from 'vitest'
22+import type { BrowserCommandContext } from 'vitest/node'
33+import type { WebSocket } from 'ws'
44+import type { BrowserServer } from './server'
55+import type { WebSocketBrowserEvents, WebSocketBrowserHandlers } from './types'
16import { existsSync, promises as fs } from 'node:fs'
22-import { dirname } from 'pathe'
77+import { ServerMockResolver } from '@vitest/mocker/node'
38import { createBirpc } from 'birpc'
49import { parse, stringify } from 'flatted'
55-import type { WebSocket } from 'ws'
66-import { WebSocketServer } from 'ws'
77-import type { BrowserCommandContext } from 'vitest/node'
1010+import { dirname } from 'pathe'
811import { createDebugger, isFileServingAllowed } from 'vitest/node'
99-import type { ErrorWithDiff } from 'vitest'
1010-import { ServerMockResolver } from '@vitest/mocker/node'
1111-import type { WebSocketBrowserEvents, WebSocketBrowserHandlers } from './types'
1212-import type { BrowserServer } from './server'
1212+import { WebSocketServer } from 'ws'
13131414const debug = createDebugger('vitest:browser:api')
1515
+7-7
packages/browser/src/node/server.ts
···11-import { readFile } from 'node:fs/promises'
22-import { fileURLToPath } from 'node:url'
11+import type { ErrorWithDiff } from '@vitest/utils'
22+import type { SerializedConfig } from 'vitest'
33import type {
44 BrowserProvider,
55 BrowserScript,
···88 Vite,
99 WorkspaceProject,
1010} from 'vitest/node'
1111-import { join, resolve } from 'pathe'
1212-import type { ErrorWithDiff } from '@vitest/utils'
1111+import { readFile } from 'node:fs/promises'
1212+import { fileURLToPath } from 'node:url'
1313import { slash } from '@vitest/utils'
1414-import { type StackTraceParserOptions, parseErrorStacktrace, parseStacktrace } from '@vitest/utils/source-map'
1515-import type { SerializedConfig } from 'vitest'
1414+import { parseErrorStacktrace, parseStacktrace, type StackTraceParserOptions } from '@vitest/utils/source-map'
1515+import { join, resolve } from 'pathe'
1616+import { BrowserServerCDPHandler } from './cdp'
1617import { BrowserServerState } from './state'
1718import { getBrowserProvider } from './utils'
1818-import { BrowserServerCDPHandler } from './cdp'
19192020export class BrowserServer implements IBrowserServer {
2121 public faviconUrl: string
+1-1
packages/browser/src/node/serverTester.ts
···11import type { IncomingMessage, ServerResponse } from 'node:http'
22+import type { BrowserServer } from './server'
23import crypto from 'node:crypto'
34import { stringify } from 'flatted'
45import { replacer } from './utils'
55-import type { BrowserServer } from './server'
6677export async function resolveTester(
88 server: BrowserServer,
+2-2
packages/browser/src/node/state.ts
···11-import { createDefer } from '@vitest/utils'
21import type { BrowserServerStateContext, BrowserServerState as IBrowserServerState } from 'vitest/node'
33-import type { WebSocketBrowserRPC } from './types'
42import type { BrowserServerCDPHandler } from './cdp'
33+import type { WebSocketBrowserRPC } from './types'
44+import { createDefer } from '@vitest/utils'
5566export class BrowserServerState implements IBrowserServerState {
77 public readonly orchestrators = new Map<string, WebSocketBrowserRPC>()
+2-2
packages/mocker/src/browser/hints.ts
···11import type { MaybeMockedDeep } from '@vitest/spy'
22-import { createSimpleStackTrace } from '@vitest/utils'
33-import { parseSingleStack } from '@vitest/utils/source-map'
42import type { ModuleMockFactoryWithHelper, ModuleMockOptions } from '../types'
53import type { ModuleMocker } from './mocker'
44+import { createSimpleStackTrace } from '@vitest/utils'
55+import { parseSingleStack } from '@vitest/utils/source-map'
6677export interface CompilerHintsOptions {
88 /**
+5-5
packages/mocker/src/browser/index.ts
···11+export { createCompilerHints } from './hints'
22+export type { CompilerHintsOptions, ModuleMockerCompilerHints } from './hints'
13export type { ModuleMockerInterceptor } from './interceptor'
22-export { ModuleMocker } from './mocker'
34export { ModuleMockerMSWInterceptor, type ModuleMockerMSWInterceptorOptions } from './interceptor-msw'
44-export { ModuleMockerServerInterceptor } from './interceptor-native'
5566+export { ModuleMockerServerInterceptor } from './interceptor-native'
77+export { ModuleMocker } from './mocker'
68export type {
77- ModuleMockerRPC,
89 ModuleMockerConfig,
1010+ ModuleMockerRPC,
911 ResolveIdResult,
1012 ResolveMockResul,
1113} from './mocker'
1212-export { createCompilerHints } from './hints'
1313-export type { CompilerHintsOptions, ModuleMockerCompilerHints } from './hints'
+5-6
packages/mocker/src/browser/interceptor-msw.ts
···11-import type { SetupWorker, StartOptions } from 'msw/browser'
21import type { HttpHandler } from 'msw'
22+import type { SetupWorker, StartOptions } from 'msw/browser'
33import type { ManualMockedModule, MockedModule } from '../registry'
44+import type { ModuleMockerInterceptor } from './interceptor'
45import { MockerRegistry } from '../registry'
56import { cleanUrl } from '../utils'
66-import type { ModuleMockerInterceptor } from './interceptor'
7788export interface ModuleMockerMSWInterceptorOptions {
99 /**
···127127 }),
128128 )
129129 return worker.start(this.options.mswOptions)
130130+ }).finally(() => {
131131+ this.started = true
132132+ this.startPromise = undefined
130133 })
131131- .finally(() => {
132132- this.started = true
133133- this.startPromise = undefined
134134- })
135134 await this.startPromise
136135 }
137136}
+3-3
packages/mocker/src/browser/mocker.ts
···11-import { extname, join } from 'pathe'
21import type { MockedModule, MockedModuleType } from '../registry'
33-import { AutomockedModule, MockerRegistry, RedirectedModule } from '../registry'
42import type { ModuleMockOptions } from '../types'
55-import { mockObject } from '../automocker'
63import type { ModuleMockerInterceptor } from './interceptor'
44+import { extname, join } from 'pathe'
55+import { mockObject } from '../automocker'
66+import { AutomockedModule, MockerRegistry, RedirectedModule } from '../registry'
7788const { now } = Date
99
+3-3
packages/mocker/src/browser/register.ts
···11-import { spyOn } from '@vitest/spy'
21import type { ModuleMockerCompilerHints } from './hints'
33-import { createCompilerHints } from './hints'
44-import { hot, rpc } from './utils'
52import type { ModuleMockerInterceptor } from './index'
33+import { spyOn } from '@vitest/spy'
44+import { createCompilerHints } from './hints'
65import { ModuleMocker } from './index'
66+import { hot, rpc } from './utils'
7788declare const __VITEST_GLOBAL_THIS_ACCESSOR__: string
99declare const __VITEST_MOCKER_ROOT__: string
+2-2
packages/mocker/src/node/automockPlugin.ts
···11-import MagicString from 'magic-string'
21import type { Plugin } from 'vite'
22+import MagicString from 'magic-string'
33import { cleanUrl } from '../utils'
44import {
55 type Declaration,
66 type ExportDefaultDeclaration,
77 type ExportNamedDeclaration,
88 type Expression,
99+ getArbitraryModuleIdentifier,
910 type Pattern,
1011 type Positioned,
1112 type Program,
1212- getArbitraryModuleIdentifier,
1313} from './esmWalker'
14141515export interface AutomockPluginOptions {
+1-1
packages/mocker/src/node/dynamicImportPlugin.ts
···11import type { SourceMap } from 'magic-string'
22-import MagicString from 'magic-string'
32import type { Plugin, Rollup } from 'vite'
43import type { Expression, Positioned } from './esmWalker'
44+import MagicString from 'magic-string'
55import { esmWalker } from './esmWalker'
6677const regexDynamicImport = /import\s*\(/
+2-2
packages/mocker/src/node/esmWalker.ts
···11import type {
22+ Node as _Node,
23 CallExpression,
34 Function as FunctionNode,
45 Identifier,
···78 Pattern,
89 Property,
910 VariableDeclaration,
1010- Node as _Node,
1111} from 'estree'
1212-import { walk as eswalk } from 'estree-walker'
1312import type { Rollup } from 'vite'
1313+import { walk as eswalk } from 'estree-walker'
14141515export type * from 'estree'
1616
+4-4
packages/mocker/src/node/hoistMocksPlugin.ts
···11-import type { SourceMap } from 'magic-string'
22-import MagicString from 'magic-string'
31import type {
42 AwaitExpression,
53 CallExpression,
···119 ImportExpression,
1210 VariableDeclaration,
1311} from 'estree'
1414-import { findNodeAround } from 'acorn-walk'
1212+import type { SourceMap } from 'magic-string'
1513import type { Plugin, Rollup } from 'vite'
1616-import { createFilter } from 'vite'
1714import type { Node, Positioned } from './esmWalker'
1515+import { findNodeAround } from 'acorn-walk'
1616+import MagicString from 'magic-string'
1717+import { createFilter } from 'vite'
1818import { esmWalker, getArbitraryModuleIdentifier } from './esmWalker'
19192020interface HoistMocksOptions {
+8-8
packages/mocker/src/node/index.ts
···11export { automockModule, automockPlugin } from './automockPlugin'
22-export { findMockRedirect } from './redirect'
33-export { hoistMocksPlugin, hoistMocks } from './hoistMocksPlugin'
44-export { ServerMockResolver } from './resolver'
22+export type { AutomockPluginOptions } from './automockPlugin'
53export { dynamicImportPlugin } from './dynamicImportPlugin'
44+export { hoistMocks, hoistMocksPlugin } from './hoistMocksPlugin'
55+export type { HoistMocksPluginOptions, HoistMocksResult } from './hoistMocksPlugin'
66export { interceptorPlugin } from './interceptorPlugin'
77-export { mockerPlugin } from './mockerPlugin'
77+export type { InterceptorPluginOptions } from './interceptorPlugin'
8899+export { mockerPlugin } from './mockerPlugin'
1010+export { findMockRedirect } from './redirect'
1111+export { ServerMockResolver } from './resolver'
912export type {
1010- ServerMockResolution,
1113 ServerIdResolution,
1414+ ServerMockResolution,
1215 ServerResolverOptions,
1316} from './resolver'
1414-export type { AutomockPluginOptions } from './automockPlugin'
1515-export type { HoistMocksPluginOptions, HoistMocksResult } from './hoistMocksPlugin'
1616-export type { InterceptorPluginOptions } from './interceptorPlugin'
+2-2
packages/mocker/src/node/interceptorPlugin.ts
···11-import { join } from 'node:path/posix'
22-import { readFile } from 'node:fs/promises'
31import type { Plugin } from 'vite'
42import type { MockedModuleSerialized } from '../registry'
33+import { readFile } from 'node:fs/promises'
44+import { join } from 'node:path/posix'
55import { ManualMockedModule, MockerRegistry } from '../registry'
66import { cleanUrl } from '../utils'
77import { automockModule } from './automockPlugin'
+5-5
packages/mocker/src/node/mockerPlugin.ts
···11-import { fileURLToPath } from 'node:url'
22-import { readFile } from 'node:fs/promises'
31import type { Plugin, ViteDevServer } from 'vite'
22+import { readFile } from 'node:fs/promises'
33+import { fileURLToPath } from 'node:url'
4455import { resolve } from 'pathe'
66-import { type AutomockPluginOptions, automockPlugin } from './automockPlugin'
77-import { type HoistMocksPluginOptions, hoistMocksPlugin } from './hoistMocksPlugin'
66+import { automockPlugin, type AutomockPluginOptions } from './automockPlugin'
87import { dynamicImportPlugin } from './dynamicImportPlugin'
99-import { ServerMockResolver } from './resolver'
88+import { hoistMocksPlugin, type HoistMocksPluginOptions } from './hoistMocksPlugin'
109import { interceptorPlugin } from './interceptorPlugin'
1010+import { ServerMockResolver } from './resolver'
11111212interface MockerPluginOptions extends AutomockPluginOptions {
1313 hoistMocks?: HoistMocksPluginOptions
+2-2
packages/mocker/src/node/resolver.ts
···11-import { existsSync, readFileSync } from 'node:fs'
22-import { isAbsolute, join, resolve } from 'pathe'
31import type { PartialResolvedId } from 'rollup'
42import type { ResolvedConfig as ViteConfig, ViteDevServer } from 'vite'
33+import { existsSync, readFileSync } from 'node:fs'
44+import { isAbsolute, join, resolve } from 'pathe'
55import { cleanUrl } from '../utils'
66import { findMockRedirect } from './redirect'
77
···55 * LICENSE file in the root directory of this source tree.
66 */
7788-import { printListItems, printObjectProperties } from '../collections'
98import type { Config, NewPlugin, Printer, Refs } from '../types'
99+import { printListItems, printObjectProperties } from '../collections'
10101111const SPACE = ' '
1212
+1-1
packages/pretty-format/src/plugins/Immutable.ts
···55 * LICENSE file in the root directory of this source tree.
66 */
7788-import { printIteratorEntries, printIteratorValues } from '../collections'
98import type { Config, NewPlugin, Printer, Refs } from '../types'
99+import { printIteratorEntries, printIteratorValues } from '../collections'
10101111// SENTINEL constants are from https://github.com/facebook/immutable-js
1212const IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@'
···55 * LICENSE file in the root directory of this source tree.
66 */
7788-import * as ReactIs from 'react-is'
98import type { Config, NewPlugin, Printer, Refs } from '../types'
99+import * as ReactIs from 'react-is'
1010import {
1111 printChildren,
1212 printElement,
+1-1
packages/runner/src/types/tasks.ts
···11import type { Awaitable, ErrorWithDiff } from '@vitest/utils'
22-import type { ChainableFunction } from '../utils/chain'
32import type { FixtureItem } from '../fixture'
33+import type { ChainableFunction } from '../utils/chain'
4455export type RunMode = 'run' | 'skip' | 'only' | 'todo'
66export type TaskState = RunMode | 'pass' | 'fail'
+1-1
packages/runner/src/utils/collect.ts
···11+import type { File, Suite, TaskBase } from '../types/tasks'
12import { processError } from '@vitest/utils/error'
23import { relative } from 'pathe'
33-import type { File, Suite, TaskBase } from '../types/tasks'
4455/**
66 * If any tasks been marked as `only`, mark all other tasks as `skip`.
···11-import { type Arrayable, toArray } from '@vitest/utils'
21import type { Custom, Suite, Task, Test } from '../types/tasks'
22+import { type Arrayable, toArray } from '@vitest/utils'
3344export function isAtomTest(s: Task): s is Test | Custom {
55 return s.type === 'test' || s.type === 'custom'
+1-1
packages/snapshot/src/env/node.ts
···11+import type { SnapshotEnvironment, SnapshotEnvironmentOptions } from '../types'
12import { existsSync, promises as fs } from 'node:fs'
23import { basename, dirname, isAbsolute, join, resolve } from 'pathe'
33-import type { SnapshotEnvironment, SnapshotEnvironmentOptions } from '../types'
4455export class NodeSnapshotEnvironment implements SnapshotEnvironment {
66 constructor(private options: SnapshotEnvironmentOptions = {}) {}
+1-1
packages/snapshot/src/port/inlineSnapshot.ts
···11import type MagicString from 'magic-string'
22+import type { SnapshotEnvironment } from '../types'
23import {
34 getCallLastIndex,
45 lineSplitRE,
56 offsetToLineNumber,
67 positionToOffset,
78} from '../../../utils/src/index'
88-import type { SnapshotEnvironment } from '../types'
991010export interface InlineSnapshot {
1111 snapshot: string
+2-2
packages/snapshot/src/port/state.ts
···7788import type { OptionsReceived as PrettyFormatOptions } from '@vitest/pretty-format'
99import type { ParsedStack } from '../../../utils/src/index'
1010-import { parseErrorStacktrace } from '../../../utils/src/source-map'
1110import type {
1211 SnapshotData,
1312 SnapshotEnvironment,
···1716 SnapshotUpdateState,
1817} from '../types'
1918import type { InlineSnapshot } from './inlineSnapshot'
2020-import { saveInlineSnapshots } from './inlineSnapshot'
2119import type { RawSnapshot, RawSnapshotInfo } from './rawSnapshot'
2020+import { parseErrorStacktrace } from '../../../utils/src/source-map'
2121+import { saveInlineSnapshots } from './inlineSnapshot'
2222import { saveRawSnapshots } from './rawSnapshot'
23232424import {
+3-3
packages/snapshot/src/port/utils.ts
···55 * LICENSE file in the root directory of this source tree.
66 */
7788-import naturalCompare from 'natural-compare'
98import type { OptionsReceived as PrettyFormatOptions } from '@vitest/pretty-format'
1010-import { format as prettyFormat } from '@vitest/pretty-format'
1111-import { isObject } from '../../../utils/src/index'
129import type { SnapshotData, SnapshotStateOptions } from '../types'
1310import type { SnapshotEnvironment } from '../types/environment'
1111+import { format as prettyFormat } from '@vitest/pretty-format'
1212+import naturalCompare from 'natural-compare'
1313+import { isObject } from '../../../utils/src/index'
1414import { getSerializers } from './plugins'
15151616// TODO: rewrite and clean up
+2-2
packages/ui/client/components/FileDetails.vue
···77 currentLogs,
88 isReport,
99} from '~/composables/client'
1010-import type { Params } from '~/composables/params'
1111-import { viewMode } from '~/composables/params'
1210import type { ModuleGraph } from '~/composables/module-graph'
1311import { getModuleGraph } from '~/composables/module-graph'
1212+import type { Params } from '~/composables/params'
1313+import { viewMode } from '~/composables/params'
1414import { getProjectNameColor } from '~/utils/task'
15151616const graph = ref<ModuleGraph>({ nodes: [], links: [] })
+5-5
packages/ui/client/components/Navigation.vue
···11<script setup lang="ts">
22-import { Tooltip as VueTooltip } from 'floating-vue'
32import type { File } from 'vitest'
33+import { Tooltip as VueTooltip } from 'floating-vue'
44+import { isDark, toggleDark } from '~/composables'
55+import { client, isReport, runAll, runFiles } from '~/composables/client'
66+import { explorerTree } from '~/composables/explorer'
77+import { initialized, shouldShowExpandAll } from '~/composables/explorer/state'
48import {
59 coverageConfigured,
610 coverageEnabled,
···1115 showCoverage,
1216 showDashboard,
1317} from '~/composables/navigation'
1414-import { client, isReport, runAll, runFiles } from '~/composables/client'
1515-import { isDark, toggleDark } from '~/composables'
1616-import { explorerTree } from '~/composables/explorer'
1717-import { initialized, shouldShowExpandAll } from '~/composables/explorer/state'
18181919function updateSnapshot() {
2020 return client.rpc.updateSnapshot()
···55 * LICENSE file in the root directory of this source tree.
66 */
7788+import type { DiffOptions, DiffOptionsNormalized } from './types'
89import diffSequences from 'diff-sequences'
99-import { DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff } from './cleanupSemantic'
1010+import { Diff, DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT } from './cleanupSemantic'
1011import {
1112 joinAlignedDiffsExpand,
1213 joinAlignedDiffsNoExpand,
1314} from './joinAlignedDiffs'
1415import { normalizeDiffOptions } from './normalizeDiffOptions'
1515-import type { DiffOptions, DiffOptionsNormalized } from './types'
16161717function isEmptyString(lines: Array<string>) {
1818 return lines.length === 1 && lines[0].length === 0
+2-2
packages/utils/src/diff/diffStrings.ts
···55 * LICENSE file in the root directory of this source tree.
66 */
7788-import diffSequences from 'diff-sequences'
99-import { DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff } from './cleanupSemantic'
108import type { DiffOptions } from './types'
99+import diffSequences from 'diff-sequences'
1010+import { Diff, DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT } from './cleanupSemantic'
11111212// platforms compatible
1313function getNewLineSymbol(string: string) {
+1-1
packages/utils/src/diff/getAlignedDiffs.ts
···55 * LICENSE file in the root directory of this source tree.
66 */
7788-import { DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff } from './cleanupSemantic'
98import type { DiffOptionsColor } from './types'
99+import { Diff, DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT } from './cleanupSemantic'
10101111// Given change op and array of diffs, return concatenated string:
1212// * include common strings
+4-4
packages/utils/src/diff/index.ts
···88// This is a fork of Jest's jest-diff package, but it doesn't depend on Node environment (like chalk).
991010import type { PrettyFormatOptions } from '@vitest/pretty-format'
1111+import type { DiffOptions } from './types'
1112import {
1213 format as prettyFormat,
1314 plugins as prettyFormatPlugins,
···1516import c from 'tinyrainbow'
1617import { stringify } from '../display'
1718import { deepClone, getOwnProperties, getType as getSimpleType } from '../helpers'
1818-import { getType } from './getType'
1919-import { DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff } from './cleanupSemantic'
1919+import { Diff, DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT } from './cleanupSemantic'
2020import { NO_DIFF_MESSAGE, SIMILAR_MESSAGE } from './constants'
2121import { diffLinesRaw, diffLinesUnified, diffLinesUnified2 } from './diffLines'
2222+import { getType } from './getType'
2223import { normalizeDiffOptions } from './normalizeDiffOptions'
2324import { diffStringsRaw, diffStringsUnified } from './printDiffs'
2424-import type { DiffOptions } from './types'
25252626export type { DiffOptions, DiffOptionsColor } from './types'
27272828export { diffLinesRaw, diffLinesUnified, diffLinesUnified2 }
2929export { diffStringsRaw, diffStringsUnified }
3030-export { DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff }
3030+export { Diff, DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT }
31313232function getCommonMessage(message: string, options?: DiffOptions) {
3333 const { commonColor } = normalizeDiffOptions(options)
+1-1
packages/utils/src/diff/joinAlignedDiffs.ts
···66 */
7788import type { Diff } from './cleanupSemantic'
99-import { DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT } from './cleanupSemantic'
109import type { DiffOptionsColor, DiffOptionsNormalized } from './types'
1010+import { DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT } from './cleanupSemantic'
11111212function formatTrailingSpaces(
1313 line: string,
+1-1
packages/utils/src/diff/normalizeDiffOptions.ts
···66 */
7788import type { CompareKeys } from '@vitest/pretty-format'
99-import c from 'tinyrainbow'
109import type { DiffOptions, DiffOptionsNormalized } from './types'
1010+import c from 'tinyrainbow'
11111212export const noColor = (string: string): string => string
1313
+2-2
packages/utils/src/diff/printDiffs.ts
···66 */
7788import type { Diff } from './cleanupSemantic'
99-import { DIFF_EQUAL, cleanupSemantic } from './cleanupSemantic'
99+import type { DiffOptions } from './types'
1010+import { cleanupSemantic, DIFF_EQUAL } from './cleanupSemantic'
1011import { diffLinesUnified, printDiffLines } from './diffLines'
1112import diffStrings from './diffStrings'
1213import getAlignedDiffs from './getAlignedDiffs'
1314import { normalizeDiffOptions } from './normalizeDiffOptions'
1414-import type { DiffOptions } from './types'
15151616function hasCommonDiff(diffs: Array<Diff>, isMultiline: boolean): boolean {
1717 if (isMultiline) {
+1-1
packages/vite-node/src/hmr/emitter.ts
···11-import { EventEmitter } from 'node:events'
21import type { HMRPayload, Plugin } from 'vite'
22+import { EventEmitter } from 'node:events'
3344export type EventType = string | symbol
55export type Handler<T = unknown> = (event: T) => void
+4-4
packages/vite-node/src/hmr/hmr.ts
···11/* eslint-disable no-console */
2233-import type { HMRPayload, Update } from 'vite/types/hmrPayload.js'
43import type { CustomEventMap } from 'vite/types/customEvent.js'
55-import c from 'tinyrainbow'
66-import createDebug from 'debug'
44+import type { HMRPayload, Update } from 'vite/types/hmrPayload.js'
75import type { ViteNodeRunner } from '../client'
86import type { HotContext } from '../types'
99-import { normalizeRequestId } from '../utils'
107import type { HMREmitter } from './emitter'
88+import createDebug from 'debug'
99+import c from 'tinyrainbow'
1010+import { normalizeRequestId } from '../utils'
11111212export type ModuleNamespace = Record<string, any> & {
1313 [Symbol.toStringTag]: 'Module'
+13-13
packages/vitest/src/api/setup.ts
···11-import { existsSync, promises as fs } from 'node:fs'
22-33-import { createBirpc } from 'birpc'
44-import { parse, stringify } from 'flatted'
55-import type { WebSocket } from 'ws'
66-import { WebSocketServer } from 'ws'
77-import type { ViteDevServer } from 'vite'
81import type { File, TaskResultPack } from '@vitest/runner'
99-import { isPrimitive, noop } from '@vitest/utils'
1010-import { API_PATH } from '../constants'
22+33+import type { ViteDevServer } from 'vite'
44+import type { WebSocket } from 'ws'
115import type { Vitest } from '../node/core'
1212-import type { Awaitable, ModuleGraphData, UserConsoleLog } from '../types/general'
136import type { Reporter } from '../node/types/reporter'
1414-import { getModuleGraph } from '../utils/graph'
1515-import { stringifyReplace } from '../utils/serialization'
1616-import { parseErrorStacktrace } from '../utils/source-map'
177import type { SerializedTestSpecification } from '../runtime/types/utils'
88+import type { Awaitable, ModuleGraphData, UserConsoleLog } from '../types/general'
189import type {
1910 TransformResultWithSource,
2011 WebSocketEvents,
2112 WebSocketHandlers,
2213 WebSocketRPC,
2314} from './types'
1515+import { existsSync, promises as fs } from 'node:fs'
1616+import { isPrimitive, noop } from '@vitest/utils'
1717+import { createBirpc } from 'birpc'
1818+import { parse, stringify } from 'flatted'
1919+import { WebSocketServer } from 'ws'
2020+import { API_PATH } from '../constants'
2121+import { getModuleGraph } from '../utils/graph'
2222+import { stringifyReplace } from '../utils/serialization'
2323+import { parseErrorStacktrace } from '../utils/source-map'
24242525export function setup(ctx: Vitest, _server?: ViteDevServer) {
2626 const wss = new WebSocketServer({ noServer: true })
+2-2
packages/vitest/src/api/types.ts
···11-import type { BirpcReturn } from 'birpc'
21import type { File, TaskResultPack } from '@vitest/runner'
33-import type { Awaitable, ModuleGraphData, UserConsoleLog } from '../types/general'
22+import type { BirpcReturn } from 'birpc'
43import type { SerializedConfig } from '../runtime/config'
54import type { SerializedTestSpecification } from '../runtime/types/utils'
55+import type { Awaitable, ModuleGraphData, UserConsoleLog } from '../types/general'
6677interface SourceMap {
88 file: string
+1-1
packages/vitest/src/integrations/coverage.ts
···11-import type { SerializedCoverageConfig } from '../runtime/config'
21import type {
32 CoverageProvider,
43 CoverageProviderModule,
54} from '../node/types/coverage'
55+import type { SerializedCoverageConfig } from '../runtime/config'
6677interface Loader {
88 executeId: (id: string) => Promise<{ default: CoverageProviderModule }>
+5-5
packages/vitest/src/integrations/vi.ts
···11import type { FakeTimerInstallOpts } from '@sinonjs/fake-timers'
22-import { assertTypes, createSimpleStackTrace } from '@vitest/utils'
33-import { parseSingleStack } from '../utils/source-map'
44-import type { VitestMocker } from '../runtime/mocker'
52import type { RuntimeOptions, SerializedConfig } from '../runtime/config'
33+import type { VitestMocker } from '../runtime/mocker'
64import type { MockFactoryWithHelper, MockOptions } from '../types/mocker'
77-import { getWorkerState, isChildProcess, resetModules, waitForImportsToResolve } from '../runtime/utils'
88-import { FakeTimers } from './mock/timers'
95import type {
106 MaybeMocked,
117 MaybeMockedDeep,
···139 MaybePartiallyMockedDeep,
1410 MockInstance,
1511} from './spy'
1212+import { assertTypes, createSimpleStackTrace } from '@vitest/utils'
1313+import { getWorkerState, isChildProcess, resetModules, waitForImportsToResolve } from '../runtime/utils'
1414+import { parseSingleStack } from '../utils/source-map'
1515+import { FakeTimers } from './mock/timers'
1616import { fn, isMockFunction, mocks, spyOn } from './spy'
1717import { waitFor, waitUntil } from './wait'
1818
+24-24
packages/vitest/src/node/core.ts
···11-import { existsSync, promises as fs } from 'node:fs'
11+import type { CancelReason, File, TaskResultPack } from '@vitest/runner'
22import type { Writable } from 'node:stream'
33import type { ViteDevServer } from 'vite'
44-import { dirname, join, normalize, relative } from 'pathe'
55-import mm from 'micromatch'
66-import { ViteNodeRunner } from 'vite-node/client'
77-import { SnapshotManager } from '@vitest/snapshot/manager'
88-import type { CancelReason, File, TaskResultPack } from '@vitest/runner'
99-import { ViteNodeServer } from 'vite-node/server'
104import type { defineWorkspace } from 'vitest/config'
1111-import { noop, slash, toArray } from '@vitest/utils'
1212-import { getTasks, hasFailed } from '@vitest/runner/utils'
1313-import { version } from '../../package.json' with { type: 'json' }
1414-import { getCoverageProvider } from '../integrations/coverage'
1515-import { defaultBrowserPort, workspacesFiles as workspaceFiles } from '../constants'
1616-import { WebSocketReporter } from '../api/setup'
175import type { SerializedCoverageConfig } from '../runtime/config'
186import type { ArgumentsType, OnServerRestartHandler, ProvidedContext, UserConsoleLog } from '../types/general'
77+import type { ProcessPool, WorkspaceSpec } from './pool'
88+import type { TestSpecification } from './spec'
99+import type { ResolvedConfig, UserConfig, VitestRunMode } from './types/config'
1010+import type { CoverageProvider } from './types/coverage'
1111+import type { Reporter } from './types/reporter'
1212+import { existsSync, promises as fs } from 'node:fs'
1313+import { getTasks, hasFailed } from '@vitest/runner/utils'
1414+import { SnapshotManager } from '@vitest/snapshot/manager'
1515+import { noop, slash, toArray } from '@vitest/utils'
1616+import mm from 'micromatch'
1717+import { dirname, join, normalize, relative } from 'pathe'
1818+import { ViteNodeRunner } from 'vite-node/client'
1919+import { ViteNodeServer } from 'vite-node/server'
2020+import { version } from '../../package.json' with { type: 'json' }
2121+import { WebSocketReporter } from '../api/setup'
2222+import { defaultBrowserPort, workspacesFiles as workspaceFiles } from '../constants'
2323+import { getCoverageProvider } from '../integrations/coverage'
1924import { distDir } from '../paths'
2025import { wildcardPatternToRegExp } from '../utils/base'
2121-import type { ProcessPool, WorkspaceSpec } from './pool'
2626+import { VitestCache } from './cache'
2727+import { resolveConfig } from './config/resolveConfig'
2828+import { FilesNotFoundError, GitNotFoundError } from './errors'
2929+import { Logger } from './logger'
3030+import { VitestPackageInstaller } from './packageInstaller'
2231import { createPool, getFilePoolName } from './pool'
3232+import { BlobReporter, readBlobs } from './reporters/blob'
2333import { createBenchmarkReporters, createReporters } from './reporters/utils'
2434import { StateManager } from './state'
2525-import { resolveConfig } from './config/resolveConfig'
2626-import { Logger } from './logger'
2727-import { VitestCache } from './cache'
2835import { WorkspaceProject } from './workspace'
2929-import { VitestPackageInstaller } from './packageInstaller'
3030-import { BlobReporter, readBlobs } from './reporters/blob'
3131-import { FilesNotFoundError, GitNotFoundError } from './errors'
3232-import type { ResolvedConfig, UserConfig, VitestRunMode } from './types/config'
3333-import type { Reporter } from './types/reporter'
3434-import type { CoverageProvider } from './types/coverage'
3536import { resolveWorkspace } from './workspace/resolveWorkspace'
3636-import type { TestSpecification } from './spec'
37373838const WATCHER_DEBOUNCE = 100
3939
+5-5
packages/vitest/src/node/create.ts
···11-import { resolve } from 'pathe'
22-import { mergeConfig } from 'vite'
31import type {
42 InlineConfig as ViteInlineConfig,
53 UserConfig as ViteUserConfig,
64} from 'vite'
77-import { findUp } from 'find-up'
88-import { configFiles } from '../constants'
95import type { VitestOptions } from './core'
66+import type { UserConfig, VitestRunMode } from './types/config'
77+import { findUp } from 'find-up'
88+import { resolve } from 'pathe'
99+import { mergeConfig } from 'vite'
1010+import { configFiles } from '../constants'
1011import { Vitest } from './core'
1112import { VitestPlugin } from './plugins'
1213import { createViteServer } from './vite'
1313-import type { UserConfig, VitestRunMode } from './types/config'
14141515export async function createVitest(
1616 mode: VitestRunMode,
+8-8
packages/vitest/src/node/error.ts
···11+import type { ErrorWithDiff, ParsedStack } from '@vitest/utils'
22+import type { Vitest } from './core'
33+import type { ErrorOptions } from './logger'
44+import type { WorkspaceProject } from './workspace'
15/* eslint-disable prefer-template */
26import { existsSync, readFileSync } from 'node:fs'
37import { Writable } from 'node:stream'
48import { stripVTControlCharacters } from 'node:util'
99+import { inspect, isPrimitive } from '@vitest/utils'
1010+import cliTruncate from 'cli-truncate'
511import { normalize, relative } from 'pathe'
612import c from 'tinyrainbow'
77-import cliTruncate from 'cli-truncate'
88-import type { ErrorWithDiff, ParsedStack } from '@vitest/utils'
99-import { inspect, isPrimitive } from '@vitest/utils'
1313+import { TypeCheckError } from '../typecheck/typechecker'
1014import {
1115 lineSplitRE,
1216 positionToOffset,
1317} from '../utils/source-map'
1414-import { TypeCheckError } from '../typecheck/typechecker'
1515-import type { Vitest } from './core'
1616-import { divider } from './reporters/renderers/utils'
1717-import type { ErrorOptions } from './logger'
1818import { Logger } from './logger'
1919-import type { WorkspaceProject } from './workspace'
2019import { F_POINTER } from './reporters/renderers/figures'
2020+import { divider } from './reporters/renderers/utils'
21212222interface PrintErrorOptions {
2323 type?: string
+1-1
packages/vitest/src/node/git.ts
···11-import { resolve } from 'pathe'
21import type { Output } from 'tinyexec'
22+import { resolve } from 'pathe'
33import { x } from 'tinyexec'
4455export interface GitOptions {
+1-1
packages/vitest/src/node/globalSetup.ts
···11-import { toArray } from '@vitest/utils'
21import type { ViteNodeRunner } from 'vite-node/client'
32import type { ProvidedContext } from '../types/general'
43import type { ResolvedConfig } from './types/config'
44+import { toArray } from '@vitest/utils'
5566export interface GlobalSetupContext {
77 config: ResolvedConfig
+10-10
packages/vitest/src/node/logger.ts
···11-import { Console } from 'node:console'
22-import type { Writable } from 'node:stream'
33-import { createLogUpdate } from 'log-update'
44-import c from 'tinyrainbow'
55-import { parseErrorStacktrace } from '@vitest/utils/source-map'
61import type { Task } from '@vitest/runner'
72import type { ErrorWithDiff } from '@vitest/utils'
88-import { toArray } from '@vitest/utils'
33+import type { Writable } from 'node:stream'
94import type { TypeCheckError } from '../typecheck/typechecker'
1010-import { highlightCode } from '../utils/colors'
1111-import { divider } from './reporters/renderers/utils'
1212-import { RandomSequencer } from './sequencers/RandomSequencer'
135import type { Vitest } from './core'
146import type { PrintErrorResult } from './error'
1515-import { printError } from './error'
167import type { WorkspaceProject } from './workspace'
88+import { Console } from 'node:console'
99+import { toArray } from '@vitest/utils'
1010+import { parseErrorStacktrace } from '@vitest/utils/source-map'
1111+import { createLogUpdate } from 'log-update'
1212+import c from 'tinyrainbow'
1313+import { highlightCode } from '../utils/colors'
1414+import { printError } from './error'
1515+import { divider } from './reporters/renderers/utils'
1616+import { RandomSequencer } from './sequencers/RandomSequencer'
17171818export interface ErrorOptions {
1919 type?: string
+2-2
packages/vitest/src/node/packageInstaller.ts
···11-import url from 'node:url'
21import { createRequire } from 'node:module'
33-import c from 'tinyrainbow'
22+import url from 'node:url'
43import { isPackageExists } from 'local-pkg'
44+import c from 'tinyrainbow'
55import { isCI } from '../utils/env'
6677const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
+6-6
packages/vitest/src/node/pool.ts
···11-import mm from 'micromatch'
21import type { Awaitable } from '@vitest/utils'
33-import { isWindows } from '../utils/env'
44-import type { BuiltinPool, Pool } from './types/pool-options'
52import type { Vitest } from './core'
33+import type { TestSpecification } from './spec'
44+import type { BuiltinPool, Pool } from './types/pool-options'
55+import type { WorkspaceProject } from './workspace'
66+import mm from 'micromatch'
77+import { isWindows } from '../utils/env'
68import { createForksPool } from './pools/forks'
79import { createThreadsPool } from './pools/threads'
88-import { createVmThreadsPool } from './pools/vmThreads'
99-import type { WorkspaceProject } from './workspace'
1010import { createTypecheckPool } from './pools/typecheck'
1111import { createVmForksPool } from './pools/vmForks'
1212-import type { TestSpecification } from './spec'
1212+import { createVmThreadsPool } from './pools/vmThreads'
13131414/**
1515 * @deprecated use TestSpecification instead
···11import type { ProvidedContext } from '../types/general'
22+import type { Vitest } from './core'
23import type { ResolvedConfig, ResolvedProjectConfig, SerializedConfig } from './types/config'
34import type { WorkspaceProject } from './workspace'
44-import type { Vitest } from './core'
5566export class TestProject {
77 /**
+1-1
packages/vitest/src/node/state.ts
···11import type { File, Task, TaskResultPack } from '@vitest/runner'
22-import { createFileTask } from '@vitest/runner/utils'
32import type { UserConsoleLog } from '../types/general'
43import type { WorkspaceProject } from './workspace'
44+import { createFileTask } from '@vitest/runner/utils'
55import { TestCase, TestModule, TestSuite } from './reporters/reported-tasks'
6677function isAggregateError(err: unknown): err is AggregateError {
+8-8
packages/vitest/src/node/stdin.ts
···11-import readline from 'node:readline'
21import type { Writable } from 'node:stream'
33-import c from 'tinyrainbow'
44-import prompt from 'prompts'
55-import { relative, resolve } from 'pathe'
66-import { toArray } from '@vitest/utils'
77-import { getTests } from '@vitest/runner/utils'
88-import { isWindows } from '../utils/env'
99-import { stdout } from '../utils/base'
102import type { Vitest } from './core'
33+import readline from 'node:readline'
44+import { getTests } from '@vitest/runner/utils'
55+import { toArray } from '@vitest/utils'
66+import { relative, resolve } from 'pathe'
77+import prompt from 'prompts'
88+import c from 'tinyrainbow'
99+import { stdout } from '../utils/base'
1010+import { isWindows } from '../utils/env'
1111import { WatchFilter } from './watch-filter'
12121313const keys = [
+2-2
packages/vitest/src/node/viteLogger.ts
···11-import type { LogErrorOptions, LogLevel, LogType, Logger, LoggerOptions } from 'vite'
21import type { RollupError } from 'rollup'
33-import colors from 'tinyrainbow'
22+import type { LogErrorOptions, Logger, LoggerOptions, LogLevel, LogType } from 'vite'
43import type { Logger as VitestLogger } from './logger'
44+import colors from 'tinyrainbow'
5566const LogLevels: Record<LogLevel, number> = {
77 silent: 0,
+2-2
packages/vitest/src/node/watch-filter.ts
···11-import readline from 'node:readline'
21import type { Writable } from 'node:stream'
22+import readline from 'node:readline'
33import { stripVTControlCharacters } from 'node:util'
44-import c from 'tinyrainbow'
54import { createDefer } from '@vitest/utils'
55+import c from 'tinyrainbow'
66import { stdout as getStdout } from '../utils/base'
7788const MAX_RESULT_COUNT = 10
+25-25
packages/vitest/src/node/workspace.ts
···11+import type {
22+ TransformResult,
33+ ViteDevServer,
44+ InlineConfig as ViteInlineConfig,
55+} from 'vite'
66+import type { Typechecker } from '../typecheck/typechecker'
77+import type { ProvidedContext } from '../types/general'
88+import type { Vitest } from './core'
99+import type { GlobalSetupFile } from './globalSetup'
1010+import type { WorkspaceSpec as DeprecatedWorkspaceSpec } from './pool'
1111+import type { BrowserServer } from './types/browser'
1212+import type {
1313+ ResolvedConfig,
1414+ SerializedConfig,
1515+ UserConfig,
1616+ UserWorkspaceConfig,
1717+} from './types/config'
118import { promises as fs } from 'node:fs'
22-import { tmpdir } from 'node:os'
319import { rm } from 'node:fs/promises'
2020+import { tmpdir } from 'node:os'
2121+import { deepMerge, nanoid } from '@vitest/utils'
2222+import fg from 'fast-glob'
423import mm from 'micromatch'
524import {
625 dirname,
···1029 resolve,
1130 toNamespacedPath,
1231} from 'pathe'
1313-import type {
1414- TransformResult,
1515- ViteDevServer,
1616- InlineConfig as ViteInlineConfig,
1717-} from 'vite'
1832import { ViteNodeRunner } from 'vite-node/client'
1933import { ViteNodeServer } from 'vite-node/server'
2020-import fg from 'fast-glob'
2121-import { deepMerge, nanoid } from '@vitest/utils'
2222-import type { Typechecker } from '../typecheck/typechecker'
2334import { setup } from '../api/setup'
2424-import type { ProvidedContext } from '../types/general'
2525-import type {
2626- ResolvedConfig,
2727- SerializedConfig,
2828- UserConfig,
2929- UserWorkspaceConfig,
3030-} from './types/config'
3131-import type { BrowserServer } from './types/browser'
3235import { isBrowserEnabled, resolveConfig } from './config/resolveConfig'
3333-import { WorkspaceVitestPlugin } from './plugins/workspace'
3434-import { createViteServer } from './vite'
3535-import type { GlobalSetupFile } from './globalSetup'
3636-import { loadGlobalSetupFiles } from './globalSetup'
3737-import { MocksPlugins } from './plugins/mocks'
3838-import { CoverageTransform } from './plugins/coverageTransform'
3936import { serializeConfig } from './config/serializeConfig'
4040-import type { Vitest } from './core'
3737+import { loadGlobalSetupFiles } from './globalSetup'
3838+import { CoverageTransform } from './plugins/coverageTransform'
3939+import { MocksPlugins } from './plugins/mocks'
4040+import { WorkspaceVitestPlugin } from './plugins/workspace'
4141import { TestProject } from './reported-workspace-project'
4242import { TestSpecification } from './spec'
4343-import type { WorkspaceSpec as DeprecatedWorkspaceSpec } from './pool'
4343+import { createViteServer } from './vite'
44444545interface InitializeProjectOptions extends UserWorkspaceConfig {
4646 workspaceConfigPath: string
+8-8
packages/vitest/src/public/browser.ts
···11-export { startTests, collectTests, processError } from '@vitest/runner'
21export {
33- setupCommonEnv,
44- loadDiffConfig,
55- loadSnapshotSerializers,
66-} from '../runtime/setup-common'
77-export {
88- takeCoverageInsideWorker,
99- stopCoverageInsideWorker,
102 getCoverageProvider,
113 startCoverageInsideWorker,
44+ stopCoverageInsideWorker,
55+ takeCoverageInsideWorker,
126} from '../integrations/coverage'
137export * as SpyModule from '../integrations/spy'
88+export {
99+ loadDiffConfig,
1010+ loadSnapshotSerializers,
1111+ setupCommonEnv,
1212+} from '../runtime/setup-common'
1313+export { collectTests, processError, startTests } from '@vitest/runner'
+7-7
packages/vitest/src/public/config.ts
···11+import type { ConfigEnv, UserConfig as ViteUserConfig } from 'vite'
22+33+import type { UserProjectConfigExport, UserProjectConfigFn, UserWorkspaceConfig, WorkspaceProjectConfiguration } from '../node/types/config'
14import '../node/types/vite'
2533-import type { ConfigEnv, UserConfig as ViteUserConfig } from 'vite'
44-import type { UserProjectConfigExport, UserProjectConfigFn, UserWorkspaceConfig, WorkspaceProjectConfiguration } from '../node/types/config'
55-66+export { extraInlineDeps } from '../constants'
67// will import vitest declare test in module 'vite'
78export {
88- defaultBrowserPort,
99 configDefaults,
1010- defaultInclude,
1111- defaultExclude,
1210 coverageConfigDefaults,
1111+ defaultBrowserPort,
1212+ defaultExclude,
1313+ defaultInclude,
1314} from '../defaults'
1415export { mergeConfig } from 'vite'
1515-export { extraInlineDeps } from '../constants'
1616export type { Plugin } from 'vite'
17171818export type { ConfigEnv, ViteUserConfig }
+1-1
packages/vitest/src/public/environments.ts
···11export { environments as builtinEnvironments } from '../integrations/env/index'
22export { populateGlobal } from '../integrations/env/utils'
33export type {
44+ Environment,
45 EnvironmentReturn,
56 VmEnvironmentReturn,
66- Environment,
77} from '../types/environment'
+175-175
packages/vitest/src/public/index.ts
···11-// TODO: deprecate <reference types="vitest" /> in favor of `<reference types="vitest/config" />`
22-import '../node/types/vite'
33-import '../types/global'
44-51import type {
62 Custom as Custom_,
73 DoneCallback as DoneCallback_,
84 File as File_,
95 RuntimeContext as RuntimeContext_,
1010- SuiteHooks as SuiteHooks_,
116 Suite as Suite_,
1212- TaskBase as TaskBase_,
1313- TaskResultPack as TaskResultPack_,
1414- TaskResult as TaskResult_,
77+ SuiteHooks as SuiteHooks_,
158 Task as Task_,
99+ TaskBase as TaskBase_,
1010+ TaskResult as TaskResult_,
1111+ TaskResultPack as TaskResultPack_,
1612 Test as Test_,
1713} from '@vitest/runner'
1818-import type {
1919- CollectLineNumbers as CollectLineNumbers_,
2020- CollectLines as CollectLines_,
2121- Context as Context_,
2222- RawErrsMap as RawErrsMap_,
2323- RootAndTarget as RootAndTarget_,
2424- TscErrorInfo as TscErrorInfo_,
2525-} from '../typecheck/types'
2626-2727-import type {
2828- WorkerRPC as WorkerRPC_,
2929-} from '../types/worker'
3030-3131-import type {
3232- ArgumentsType as ArgumentsType_,
3333- Arrayable as Arrayable_,
3434- Awaitable as Awaitable_,
3535- Constructable as Constructable_,
3636- MutableArray as MutableArray_,
3737- Nullable as Nullable_,
3838- OnServerRestartHandler as OnServerRestartHandler_,
3939-} from '../types/general'
4040-4141-import type {
4242- EnvironmentReturn as EnvironmentReturn_,
4343- Environment as Environment_,
4444- ResolvedTestEnvironment as ResolvedTestEnvironment_,
4545- VmEnvironmentReturn as VmEnvironmentReturn_,
4646-} from '../types/environment'
4747-4848-import type {
4949- BaseCoverageOptions as BaseCoverageOptions_,
5050- CoverageIstanbulOptions as CoverageIstanbulOptions_,
5151- CoverageOptions as CoverageOptions_,
5252- CoverageProviderModule as CoverageProviderModule_,
5353- CoverageProviderName,
5454- CoverageProvider as CoverageProvider_,
5555- CoverageReporter as CoverageReporter_,
5656- CoverageV8Options as CoverageV8Options_,
5757- CustomProviderOptions as CustomProviderOptions_,
5858- ReportContext as ReportContext_,
5959- ResolvedCoverageOptions as ResolvedCoverageOptions_,
6060-} from '../node/types/coverage'
6161-6262-import type {
6363- /** @deprecated import from `vitest/node` instead */
6464- Reporter as Reporter_,
6565-} from '../node/types/reporter'
6614import type {
6715 /** @deprecated import from `vitest/node` instead */
6816 Vitest as Vitest_,
6917} from '../node/core'
1818+1919+import type {
2020+ BenchmarkUserOptions as BenchmarkUserOptions_,
2121+} from '../node/types/benchmark'
7022import type {
7123 ApiConfig as ApiConfig_,
7224 BrowserConfigOptions as BrowserConfigOptions_,
···7830 HappyDOMOptions as HappyDOMOptions_,
7931 InlineConfig as InlineConfig_,
8032 JSDOMOptions as JSDOMOptions_,
8181- PoolOptions as PoolOptions_,
8233 Pool as Pool_,
3434+ PoolOptions as PoolOptions_,
8335 ProjectConfig as ProjectConfig_,
8436 ResolvedConfig as ResolvedConfig_,
8537 SequenceHooks as SequenceHooks_,
···9143 VitestEnvironment as VitestEnvironment_,
9244 VitestRunMode as VitestRunMode_,
9345} from '../node/types/config'
9494-import type {
9595- BenchmarkUserOptions as BenchmarkUserOptions_,
9696-} from '../node/types/benchmark'
97469898-import type { SerializedTestSpecification } from '../runtime/types/utils'
4747+import type {
4848+ BaseCoverageOptions as BaseCoverageOptions_,
4949+ CoverageIstanbulOptions as CoverageIstanbulOptions_,
5050+ CoverageOptions as CoverageOptions_,
5151+ CoverageProvider as CoverageProvider_,
5252+ CoverageProviderModule as CoverageProviderModule_,
5353+ CoverageProviderName,
5454+ CoverageReporter as CoverageReporter_,
5555+ CoverageV8Options as CoverageV8Options_,
5656+ CustomProviderOptions as CustomProviderOptions_,
5757+ ReportContext as ReportContext_,
5858+ ResolvedCoverageOptions as ResolvedCoverageOptions_,
5959+} from '../node/types/coverage'
6060+6161+import type {
6262+ /** @deprecated import from `vitest/node` instead */
6363+ Reporter as Reporter_,
6464+} from '../node/types/reporter'
6565+9966import type {
10067 WorkerContext as WorkerContext_,
10168} from '../node/types/worker'
10269103103-export {
104104- suite,
105105- test,
106106- describe,
107107- it,
108108- beforeAll,
109109- beforeEach,
110110- afterAll,
111111- afterEach,
112112- onTestFailed,
113113- onTestFinished,
114114-} from '@vitest/runner'
115115-export { bench } from '../runtime/benchmark'
116116-export { expectTypeOf } from '../typecheck/expectTypeOf'
117117-export { assertType } from '../typecheck/assertType'
7070+import type { SerializedTestSpecification } from '../runtime/types/utils'
11871119119-export { runOnce, isFirstRun } from '../integrations/run-once'
120120-export { createExpect, assert, should, chai, expect } from '../integrations/chai'
121121-export { vi, vitest } from '../integrations/vi'
122122-export { getRunningMode, isWatchMode } from '../integrations/utils'
7272+import type {
7373+ CollectLineNumbers as CollectLineNumbers_,
7474+ CollectLines as CollectLines_,
7575+ Context as Context_,
7676+ RawErrsMap as RawErrsMap_,
7777+ RootAndTarget as RootAndTarget_,
7878+ TscErrorInfo as TscErrorInfo_,
7979+} from '../typecheck/types'
8080+import type {
8181+ Environment as Environment_,
8282+ EnvironmentReturn as EnvironmentReturn_,
8383+ ResolvedTestEnvironment as ResolvedTestEnvironment_,
8484+ VmEnvironmentReturn as VmEnvironmentReturn_,
8585+} from '../types/environment'
8686+import type {
8787+ ArgumentsType as ArgumentsType_,
8888+ Arrayable as Arrayable_,
8989+ Awaitable as Awaitable_,
9090+ Constructable as Constructable_,
9191+ MutableArray as MutableArray_,
9292+ Nullable as Nullable_,
9393+ OnServerRestartHandler as OnServerRestartHandler_,
9494+} from '../types/general'
9595+import type {
9696+ WorkerRPC as WorkerRPC_,
9797+} from '../types/worker'
9898+9999+// TODO: deprecate <reference types="vitest" /> in favor of `<reference types="vitest/config" />`
100100+import '../node/types/vite'
101101+import '../types/global'
102102+103103+export type {
104104+ TransformResultWithSource,
105105+ WebSocketEvents,
106106+ WebSocketHandlers,
107107+ WebSocketRPC,
108108+} from '../api/types'
109109+export { assert, chai, createExpect, expect, should } from '../integrations/chai'
123110export { inject } from '../integrations/inject'
111111+export { isFirstRun, runOnce } from '../integrations/run-once'
124112113113+export type {
114114+ Mock,
115115+ MockContext,
116116+ Mocked,
117117+ MockedClass,
118118+ MockedFunction,
119119+ MockedObject,
120120+ MockInstance,
121121+} from '../integrations/spy'
122122+export { getRunningMode, isWatchMode } from '../integrations/utils'
123123+export { vi, vitest } from '../integrations/vi'
125124export type { VitestUtils } from '../integrations/vi'
125125+export { bench } from '../runtime/benchmark'
126126127127-export type { ExpectTypeOf } from '../typecheck/expectTypeOf'
128128-export type { AssertType } from '../typecheck/assertType'
127127+export type {
128128+ RuntimeConfig,
129129+ SerializedConfig,
130130+ SerializedCoverageConfig,
131131+} from '../runtime/config'
132132+133133+export type {
134134+ BenchFactory,
135135+ BenchFunction,
136136+ Benchmark,
137137+ BenchmarkAPI,
138138+ BenchmarkResult,
139139+ BenchOptions,
140140+ BenchTask,
141141+ BenchTaskResult,
142142+} from '../runtime/types/benchmark'
143143+export { assertType } from '../typecheck/assertType'
129144130145/** @deprecated import `TypeCheckRawErrorsMap` from `vitest/node` instead */
131146export type RawErrsMap = RawErrsMap_
···165180/** @deprecated internal type, don't use it */
166181export type SuiteHooks = SuiteHooks_
167182168168-export type {
169169- RunMode,
170170- TaskState,
171171- TaskBase as RunnerTaskBase,
172172- TaskResult as RunnerTaskResult,
173173- TaskResultPack as RunnerTaskResultPack,
174174- Suite as RunnerTestSuite,
175175- File as RunnerTestFile,
176176- Test as RunnerTestCase,
177177- Task as RunnerTask,
178178- Custom as RunnerCustomCase,
179179- TestFunction,
180180- TestOptions,
181181- TestAPI,
182182- SuiteAPI,
183183- HookListener,
184184- HookCleanupCallback,
185185- SuiteCollector,
186186- SuiteFactory,
187187- TestContext,
188188- TaskContext,
189189- ExtendedContext,
190190- TaskCustomOptions,
191191- OnTestFailedHandler,
192192- OnTestFinishedHandler,
193193- TaskMeta,
194194-} from '@vitest/runner'
195195-export type {
196196- RuntimeRPC,
197197- RunnerRPC,
198198-} from '../types/rpc'
199199-export type {
200200- SnapshotData,
201201- SnapshotUpdateState,
202202- SnapshotStateOptions,
203203- SnapshotMatchOptions,
204204- SnapshotResult,
205205- UncheckedSnapshot,
206206- SnapshotSummary,
207207- SnapshotSerializer,
208208-} from '@vitest/snapshot'
183183+export type { AssertType } from '../typecheck/assertType'
184184+export { expectTypeOf } from '../typecheck/expectTypeOf'
185185+export type { ExpectTypeOf } from '../typecheck/expectTypeOf'
209186210187/** @deprecated import from `vitest/node` instead */
211188export type WorkerContext = WorkerContext_
···213190export type WorkerRPC = WorkerRPC_
214191215192export type {
216216- ResolveIdFunction,
217217- WorkerGlobalState,
218218- ContextTestEnvironment,
219219- ContextRPC,
220220-} from '../types/worker'
193193+ AfterSuiteRunMeta,
194194+ ErrorWithDiff,
195195+ ModuleCache,
196196+ ModuleGraphData,
197197+ ParsedStack,
198198+ ProvidedContext,
199199+ UserConsoleLog,
200200+} from '../types/general'
221201222202/** @deprecated do not use, internal helper */
223203export type Awaitable<T> = Awaitable_<T>
···235215export type OnServerRestartHandler = OnServerRestartHandler_
236216237217export type {
238238- ErrorWithDiff,
239239- ParsedStack,
240240- ModuleCache,
241241- UserConsoleLog,
242242- ModuleGraphData,
243243- ProvidedContext,
244244- AfterSuiteRunMeta,
245245-} from '../types/general'
218218+ RunnerRPC,
219219+ RuntimeRPC,
220220+} from '../types/rpc'
246221247247-export type { TestError, SerializedError } from '@vitest/utils'
222222+export type { BrowserUI } from '../types/ui'
248223249224/** @deprecated import from `vitest/environments` instead */
250225export type EnvironmentReturn = EnvironmentReturn_
···276251/** @deprecated import from `vitest/node` instead */
277252export type CustomProviderOptions = CustomProviderOptions_
278253279279-export type { CancelReason } from '@vitest/runner'
280280-export type { DiffOptions } from '@vitest/utils/diff'
281254export type {
282282- MockedFunction,
283283- MockedObject,
284284- MockInstance,
285285- Mock,
286286- MockContext,
287287- Mocked,
288288- MockedClass,
289289-} from '../integrations/spy'
290290-export type { BrowserUI } from '../types/ui'
255255+ ContextRPC,
256256+ ContextTestEnvironment,
257257+ ResolveIdFunction,
258258+ WorkerGlobalState,
259259+} from '../types/worker'
260260+export type {
261261+ Assertion,
262262+ AsymmetricMatchersContaining,
263263+ ExpectPollOptions,
264264+ ExpectStatic,
265265+ JestAssertion,
266266+} from '@vitest/expect'
267267+export {
268268+ afterAll,
269269+ afterEach,
270270+ beforeAll,
271271+ beforeEach,
272272+ describe,
273273+ it,
274274+ onTestFailed,
275275+ onTestFinished,
276276+ suite,
277277+ test,
278278+} from '@vitest/runner'
279279+export type {
280280+ Custom as RunnerCustomCase,
281281+ ExtendedContext,
282282+ File as RunnerTestFile,
283283+ HookCleanupCallback,
284284+ HookListener,
285285+ OnTestFailedHandler,
286286+ OnTestFinishedHandler,
287287+ RunMode,
288288+ Suite as RunnerTestSuite,
289289+ SuiteAPI,
290290+ SuiteCollector,
291291+ SuiteFactory,
292292+ Task as RunnerTask,
293293+ TaskBase as RunnerTaskBase,
294294+ TaskContext,
295295+ TaskCustomOptions,
296296+ TaskMeta,
297297+ TaskResult as RunnerTaskResult,
298298+ TaskResultPack as RunnerTaskResultPack,
299299+ TaskState,
300300+ Test as RunnerTestCase,
301301+ TestAPI,
302302+ TestContext,
303303+ TestFunction,
304304+ TestOptions,
305305+} from '@vitest/runner'
291306292307/** @deprecated import from `vitest/reporter` instead */
293308export type Reporter = Reporter_
294309/** @deprecated import from `vitest/node` instead */
295310export type Vitest = Vitest_
296311297297-export type {
298298- ExpectStatic,
299299- AsymmetricMatchersContaining,
300300- JestAssertion,
301301- Assertion,
302302- ExpectPollOptions,
303303-} from '@vitest/expect'
312312+export type { CancelReason } from '@vitest/runner'
304313305314export type {
306306- SerializedConfig,
307307- RuntimeConfig,
308308- SerializedCoverageConfig,
309309-} from '../runtime/config'
315315+ SnapshotData,
316316+ SnapshotMatchOptions,
317317+ SnapshotResult,
318318+ SnapshotSerializer,
319319+ SnapshotStateOptions,
320320+ SnapshotSummary,
321321+ SnapshotUpdateState,
322322+ UncheckedSnapshot,
323323+} from '@vitest/snapshot'
310324311325/** @deprecated import from `vitest/node` instead */
312326export type BrowserScript = BrowserScript_
···353367/** @deprecated import from `vitest/node` instead */
354368export type UserWorkspaceConfig = UserWorkspaceConfig_
355369356356-export type {
357357- Benchmark,
358358- BenchmarkResult,
359359- BenchFunction,
360360- BenchmarkAPI,
361361- BenchTaskResult,
362362- BenchOptions,
363363- BenchFactory,
364364- BenchTask,
365365-} from '../runtime/types/benchmark'
370370+export type { SerializedError, TestError } from '@vitest/utils'
366371367372/** @deprecated use `SerializedTestSpecification` instead */
368373export type SerializableSpec = SerializedTestSpecification
···371376/** @deprecated import from `vitest/node` instead */
372377export type BenchmarkUserOptions = BenchmarkUserOptions_
373378374374-export type {
375375- TransformResultWithSource,
376376- WebSocketHandlers,
377377- WebSocketEvents,
378378- WebSocketRPC,
379379-} from '../api/types'
379379+export type { DiffOptions } from '@vitest/utils/diff'
+94-94
packages/vitest/src/public/node.ts
···11+import type { ModuleDiagnostic as _FileDiagnostic } from '../node/reporters/reported-tasks'
12import { createServer as _createServer } from 'vite'
23import { TestModule as _TestFile } from '../node/reporters/reported-tasks'
33-import type { ModuleDiagnostic as _FileDiagnostic } from '../node/reporters/reported-tasks'
4455-export type { Vitest } from '../node/core'
66-export type { WorkspaceProject } from '../node/workspace'
77-export { createVitest } from '../node/create'
88-export { VitestPlugin } from '../node/plugins'
99-export { startVitest } from '../node/cli/cli-api'
105export { parseCLI } from '../node/cli/cac'
1111-export { registerConsoleShortcuts } from '../node/stdin'
1212-export type { GlobalSetupContext } from '../node/globalSetup'
1313-export type { WorkspaceSpec, ProcessPool } from '../node/pool'
1414-export { createMethodsRPC } from '../node/pools/rpc'
1515-export { getFilePoolName } from '../node/pool'
1616-export { VitestPackageInstaller } from '../node/packageInstaller'
1717-export { createDebugger } from '../utils/debugger'
1818-export { resolveFsAllow } from '../node/plugins/utils'
66+export { startVitest } from '../node/cli/cli-api'
197export { resolveApiServerConfig, resolveConfig } from '../node/config/resolveConfig'
2020-export { TestSpecification } from '../node/spec'
2121-export { createViteLogger } from '../node/viteLogger'
88+export type { Vitest } from '../node/core'
99+export { createVitest } from '../node/create'
1010+export { FilesNotFoundError as TestsNotFoundError, GitNotFoundError } from '../node/errors'
1111+export type { GlobalSetupContext } from '../node/globalSetup'
1212+export { VitestPackageInstaller } from '../node/packageInstaller'
1313+export { VitestPlugin } from '../node/plugins'
1414+export { resolveFsAllow } from '../node/plugins/utils'
1515+export type { ProcessPool, WorkspaceSpec } from '../node/pool'
1616+export { getFilePoolName } from '../node/pool'
1717+export { createMethodsRPC } from '../node/pools/rpc'
1818+export { TestProject } from '../node/reported-workspace-project'
1919+export type { SerializedTestProject } from '../node/reported-workspace-project'
2020+export type { HTMLOptions } from '../node/reporters/html'
2121+export type { JsonOptions } from '../node/reporters/json'
22222323-export { GitNotFoundError, FilesNotFoundError as TestsNotFoundError } from '../node/errors'
2323+export type { JUnitOptions } from '../node/reporters/junit'
24242525-export { distDir, rootDir } from '../paths'
2525+export { TestCase, TestModule, TestSuite } from '../node/reporters/reported-tasks'
2626+2727+export type {
2828+ ModuleDiagnostic,
2929+3030+ TaskOptions,
3131+ TestCollection,
3232+ TestDiagnostic,
3333+ TestResult,
3434+ TestResultFailed,
3535+ TestResultPassed,
3636+ TestResultSkipped,
3737+} from '../node/reporters/reported-tasks'
3838+export { BaseSequencer } from '../node/sequencers/BaseSequencer'
26392740export type {
2841 TestSequencer,
2942 TestSequencerConstructor,
3043} from '../node/sequencers/types'
3131-export { BaseSequencer } from '../node/sequencers/BaseSequencer'
4444+export { TestSpecification } from '../node/spec'
4545+export { registerConsoleShortcuts } from '../node/stdin'
4646+export type { BenchmarkUserOptions } from '../node/types/benchmark'
32473348export type {
3434- BrowserProviderInitializationOptions,
3535- BrowserProvider,
3636- CDPSession,
3737- BrowserProviderModule,
3838- ResolvedBrowserOptions,
3939- BrowserProviderOptions,
4049 BrowserBuiltinProvider,
4141- BrowserScript,
4250 BrowserCommand,
4351 BrowserCommandContext,
5252+ BrowserConfigOptions,
5353+ BrowserOrchestrator,
5454+ BrowserProvider,
5555+ BrowserProviderInitializationOptions,
5656+ BrowserProviderModule,
5757+ BrowserProviderOptions,
5858+ BrowserScript,
4459 BrowserServer,
4560 BrowserServerState,
4661 BrowserServerStateContext,
4747- BrowserOrchestrator,
4848- BrowserConfigOptions,
6262+ CDPSession,
6363+ ResolvedBrowserOptions,
4964} from '../node/types/browser'
5050-export type { JsonOptions } from '../node/reporters/json'
5151-export type { JUnitOptions } from '../node/reporters/junit'
5252-export type { HTMLOptions } from '../node/reporters/html'
5353-5454-export {
5555- isFileServingAllowed,
5656- parseAst,
5757- parseAstAsync,
5858-} from 'vite'
5965/** @deprecated use `createViteServer` instead */
6066export const createServer = _createServer
6167export const createViteServer = _createServer
6262-export type * as Vite from 'vite'
6868+export type {
6969+ ApiConfig,
7070+ BuiltinEnvironment,
7171+ CSSModuleScopeStrategy,
7272+ DepsOptimizationOptions,
7373+ EnvironmentOptions,
7474+ HappyDOMOptions,
7575+ InlineConfig,
7676+ JSDOMOptions,
7777+ Pool,
7878+ PoolOptions,
7979+ ProjectConfig,
8080+ ResolvedConfig,
8181+ ResolvedProjectConfig,
8282+ RuntimeConfig,
8383+ SequenceHooks,
8484+ SequenceSetupFiles,
8585+ TransformModePatterns,
8686+ TypecheckConfig,
8787+ UserConfig,
8888+ UserWorkspaceConfig,
8989+ VitestEnvironment,
9090+ VitestRunMode,
9191+} from '../node/types/config'
63926464-export { TestCase, TestModule, TestSuite } from '../node/reporters/reported-tasks'
9393+export type {
9494+ BaseCoverageOptions,
9595+ CoverageIstanbulOptions,
9696+ CoverageOptions,
9797+ CoverageProvider,
9898+ CoverageProviderModule,
9999+ CoverageReporter,
100100+ CoverageV8Options,
101101+ CustomProviderOptions,
102102+ ReportContext,
103103+ ResolvedCoverageOptions,
104104+} from '../node/types/coverage'
65105/**
66106 * @deprecated Use `TestModule` instead
67107 */
68108export const TestFile = _TestFile
6969-export { TestProject } from '../node/reported-workspace-project'
7070-export type { SerializedTestProject } from '../node/reported-workspace-project'
7171-export type {
7272- TestCollection,
7373-7474- TaskOptions,
7575- TestDiagnostic,
7676- ModuleDiagnostic,
7777- TestResult,
7878- TestResultPassed,
7979- TestResultFailed,
8080- TestResultSkipped,
8181-} from '../node/reporters/reported-tasks'
109109+export type { WorkerContext } from '../node/types/worker'
110110+export { createViteLogger } from '../node/viteLogger'
111111+export type { WorkspaceProject } from '../node/workspace'
8211283113/**
84114 * @deprecated Use `ModuleDiagnostic` instead
85115 */
86116export type FileDiagnostic = _FileDiagnostic
871178888-export type {
8989- SequenceHooks,
9090- SequenceSetupFiles,
9191- BuiltinEnvironment,
9292- VitestEnvironment,
9393- Pool,
9494- PoolOptions,
9595- CSSModuleScopeStrategy,
9696- ApiConfig,
9797- JSDOMOptions,
9898- HappyDOMOptions,
9999- EnvironmentOptions,
100100- VitestRunMode,
101101- DepsOptimizationOptions,
102102- TransformModePatterns,
103103- InlineConfig,
104104- TypecheckConfig,
105105- UserConfig,
106106- ResolvedConfig,
107107- ProjectConfig,
108108- ResolvedProjectConfig,
109109- UserWorkspaceConfig,
110110- RuntimeConfig,
111111-} from '../node/types/config'
112112-113113-export type { BenchmarkUserOptions } from '../node/types/benchmark'
118118+export { distDir, rootDir } from '../paths'
114119115120export type {
116116- RawErrsMap as TypeCheckRawErrorsMap,
117117- TscErrorInfo as TypeCheckErrorInfo,
118121 CollectLineNumbers as TypeCheckCollectLineNumbers,
119122 CollectLines as TypeCheckCollectLines,
120120- RootAndTarget as TypeCheckRootAndTarget,
121123 Context as TypeCheckContext,
124124+ RawErrsMap as TypeCheckRawErrorsMap,
125125+ RootAndTarget as TypeCheckRootAndTarget,
126126+ TscErrorInfo as TypeCheckErrorInfo,
122127} from '../typecheck/types'
123128124129export type { OnServerRestartHandler } from '../types/general'
125130126126-export type {
127127- CoverageProvider,
128128- ReportContext,
129129- CoverageProviderModule,
130130- CoverageReporter,
131131- CoverageOptions,
132132- ResolvedCoverageOptions,
133133- BaseCoverageOptions,
134134- CoverageIstanbulOptions,
135135- CoverageV8Options,
136136- CustomProviderOptions,
137137-} from '../node/types/coverage'
131131+export { createDebugger } from '../utils/debugger'
138132139139-export type { WorkerContext } from '../node/types/worker'
133133+export {
134134+ isFileServingAllowed,
135135+ parseAst,
136136+ parseAstAsync,
137137+} from 'vite'
138138+139139+export type * as Vite from 'vite'
+1-1
packages/vitest/src/public/runners.ts
···11-export { VitestTestRunner } from '../runtime/runners/test'
21export { NodeBenchmarkRunner } from '../runtime/runners/benchmark'
22+export { VitestTestRunner } from '../runtime/runners/test'
+1-1
packages/vitest/src/public/snapshot.ts
···11-export type { SnapshotEnvironment } from '@vitest/snapshot/environment'
21export { VitestNodeSnapshotEnvironment as VitestSnapshotEnvironment } from '../integrations/snapshot/environments/node'
22+export type { SnapshotEnvironment } from '@vitest/snapshot/environment'
···11+export { provideWorkerState } from '../runtime/utils'
22+export { collect as collectVitestWorkerTests, run as runVitestWorker } from '../runtime/worker'
33+export { runBaseTests } from '../runtime/workers/base'
44+export type { VitestWorker, WorkerRpcOptions } from '../runtime/workers/types'
15export {
26 createForksRpcOptions,
37 createThreadsRpcOptions,
48 unwrapSerializableConfig,
59} from '../runtime/workers/utils'
66-export { provideWorkerState } from '../runtime/utils'
77-export { run as runVitestWorker, collect as collectVitestWorkerTests } from '../runtime/worker'
810export { runVmTests } from '../runtime/workers/vm'
99-export { runBaseTests } from '../runtime/workers/base'
1010-export type { WorkerRpcOptions, VitestWorker } from '../runtime/workers/types'
+1-1
packages/vitest/src/runtime/benchmark.ts
···11import type { Custom } from '@vitest/runner'
22+import type { BenchFunction, BenchmarkAPI, BenchOptions } from './types/benchmark'
23import { getCurrentSuite } from '@vitest/runner'
34import { createChainable } from '@vitest/runner/utils'
45import { noop } from '@vitest/utils'
55-import type { BenchFunction, BenchOptions, BenchmarkAPI } from './types/benchmark'
66import { getWorkerState } from './utils'
7788const benchFns = new WeakMap<Custom, BenchFunction>()
+2-2
packages/vitest/src/runtime/console.ts
···11-import { Writable } from 'node:stream'
11+import type { WorkerGlobalState } from '../types/worker'
22import { Console } from 'node:console'
33import { relative } from 'node:path'
44+import { Writable } from 'node:stream'
45import { getSafeTimers } from '@vitest/utils'
56import c from 'tinyrainbow'
67import { RealDate } from '../integrations/mock/date'
77-import type { WorkerGlobalState } from '../types/worker'
88import { getWorkerState } from './utils'
991010export const UNKNOWN_TEST_ID = '__vitest__unknown_test__'
+8-8
packages/vitest/src/runtime/execute.ts
···11-import vm from 'node:vm'
22-import { pathToFileURL } from 'node:url'
33-import fs from 'node:fs'
11+import type { ViteNodeRunnerOptions } from 'vite-node'
42import type { ModuleCacheMap } from 'vite-node/client'
33+import type { WorkerGlobalState } from '../types/worker'
44+import type { ExternalModulesExecutor } from './external-executor'
55+import fs from 'node:fs'
66+import { pathToFileURL } from 'node:url'
77+import vm from 'node:vm'
88+import { processError } from '@vitest/utils/error'
99+import { normalize, relative } from 'pathe'
510import { DEFAULT_REQUEST_STUBS, ViteNodeRunner } from 'vite-node/client'
611import {
712 isInternalRequest,
···914 isPrimitive,
1015 toFilePath,
1116} from 'vite-node/utils'
1212-import type { ViteNodeRunnerOptions } from 'vite-node'
1313-import { normalize, relative } from 'pathe'
1414-import { processError } from '@vitest/utils/error'
1517import { distDir } from '../paths'
1616-import type { WorkerGlobalState } from '../types/worker'
1718import { VitestMocker } from './mocker'
1818-import type { ExternalModulesExecutor } from './external-executor'
19192020const { readFileSync } = fs
2121
+6-6
packages/vitest/src/runtime/external-executor.ts
···11-import vm from 'node:vm'
22-import { fileURLToPath, pathToFileURL } from 'node:url'
33-import { dirname } from 'node:path'
11+import type { RuntimeRPC } from '../types/rpc'
22+import type { FileMap } from './vm/file-map'
33+import type { VMModule, VMSyntheticModule } from './vm/types'
44import fs from 'node:fs'
55+import { dirname } from 'node:path'
66+import { fileURLToPath, pathToFileURL } from 'node:url'
77+import vm from 'node:vm'
58import { extname, join, normalize } from 'pathe'
69import { getCachedData, isNodeBuiltin, setCacheData } from 'vite-node/utils'
77-import type { RuntimeRPC } from '../types/rpc'
88-import type { VMModule, VMSyntheticModule } from './vm/types'
910import { CommonjsExecutor } from './vm/commonjs-executor'
1010-import type { FileMap } from './vm/file-map'
1111import { EsmExecutor } from './vm/esm-executor'
1212import { interopCommonJsModule } from './vm/utils'
1313import { ViteExecutor } from './vm/vite-executor'
+2-2
packages/vitest/src/runtime/inspector.ts
···11-import { createRequire } from 'node:module'
22-import { pathToFileURL } from 'node:url'
31import type { ContextRPC } from '../types/worker'
42import type { SerializedConfig } from './config'
33+import { createRequire } from 'node:module'
44+import { pathToFileURL } from 'node:url'
5566const __require = createRequire(import.meta.url)
77let inspector: typeof import('node:inspector')
+6-6
packages/vitest/src/runtime/mocker.ts
···11-import vm from 'node:vm'
22-import { isAbsolute, resolve } from 'pathe'
33-import { highlight } from '@vitest/utils'
41import type { ManualMockedModule, MockedModuleType } from '@vitest/mocker'
55-import { AutomockedModule, MockerRegistry, RedirectedModule, mockObject } from '@vitest/mocker'
66-import { findMockRedirect } from '@vitest/mocker/redirect'
77-import { distDir } from '../paths'
82import type { MockFactory, MockOptions, PendingSuiteMock } from '../types/mocker'
93import type { VitestExecutor } from './execute'
44+import vm from 'node:vm'
55+import { AutomockedModule, MockerRegistry, mockObject, RedirectedModule } from '@vitest/mocker'
66+import { findMockRedirect } from '@vitest/mocker/redirect'
77+import { highlight } from '@vitest/utils'
88+import { isAbsolute, resolve } from 'pathe'
99+import { distDir } from '../paths'
10101111const spyModulePath = resolve(distDir, 'spy.js')
1212
+2-2
packages/vitest/src/runtime/rpc.ts
···11-import { getSafeTimers } from '@vitest/utils'
21import type { CancelReason } from '@vitest/runner'
33-import { createBirpc } from 'birpc'
42import type { BirpcOptions, BirpcReturn } from 'birpc'
53import type { RunnerRPC, RuntimeRPC } from '../types/rpc'
64import type { WorkerRPC } from '../types/worker'
55+import { getSafeTimers } from '@vitest/utils'
66+import { createBirpc } from 'birpc'
77import { getWorkerState } from './utils'
8899const { get } = Reflect
+7-7
packages/vitest/src/runtime/runBaseTests.ts
···11+import type { ResolvedTestEnvironment } from '../types/environment'
22+import type { SerializedConfig } from './config'
33+import type { VitestExecutor } from './execute'
14import { performance } from 'node:perf_hooks'
25import { collectTests, startTests } from '@vitest/runner'
33-import { vi } from '../integrations/vi'
66+import { setupChaiConfig } from '../integrations/chai/config'
47import {
58 startCoverageInsideWorker,
69 stopCoverageInsideWorker,
710} from '../integrations/coverage'
88-import { setupChaiConfig } from '../integrations/chai/config'
99-import type { ResolvedTestEnvironment } from '../types/environment'
1010-import type { SerializedConfig } from './config'
1111-import { setupGlobalEnv, withEnv } from './setup-node'
1212-import type { VitestExecutor } from './execute'
1313-import { resolveTestRunner } from './runners'
1111+import { vi } from '../integrations/vi'
1412import { closeInspector } from './inspector'
1313+import { resolveTestRunner } from './runners'
1414+import { setupGlobalEnv, withEnv } from './setup-node'
1515import { getWorkerState, resetModules } from './utils'
16161717// browser shouldn't call this!
+8-8
packages/vitest/src/runtime/runVmTests.ts
···11+import type { SerializedConfig } from './config'
22+import type { VitestExecutor } from './execute'
13import { createRequire } from 'node:module'
22-import util from 'node:util'
33-import timers from 'node:timers'
44import { performance } from 'node:perf_hooks'
55+import timers from 'node:timers'
66+import util from 'node:util'
57import { collectTests, startTests } from '@vitest/runner'
66-import { installSourcemapsSupport } from 'vite-node/source-map'
78import { KNOWN_ASSET_TYPES } from 'vite-node/constants'
99+import { installSourcemapsSupport } from 'vite-node/source-map'
810import { setupChaiConfig } from '../integrations/chai/config'
911import {
1012 startCoverageInsideWorker,
1113 stopCoverageInsideWorker,
1214} from '../integrations/coverage'
1313-import * as VitestIndex from '../public/index'
1415import { resolveSnapshotEnvironment } from '../integrations/snapshot/environments/resolveSnapshotEnvironment'
1515-import { getWorkerState } from './utils'
1616-import type { VitestExecutor } from './execute'
1616+import * as VitestIndex from '../public/index'
1717+import { closeInspector } from './inspector'
1718import { resolveTestRunner } from './runners'
1819import { setupCommonEnv } from './setup-common'
1919-import { closeInspector } from './inspector'
2020-import type { SerializedConfig } from './config'
2020+import { getWorkerState } from './utils'
21212222export async function run(
2323 method: 'run' | 'collect',
+5-5
packages/vitest/src/runtime/setup-common.ts
···11-import { setSafeTimers } from '@vitest/utils'
22-import { addSerializer } from '@vitest/snapshot'
33-import type { SnapshotSerializer } from '@vitest/snapshot'
41import type { DiffOptions } from '@vitest/expect'
55-import { resetRunOnceCounter } from '../integrations/run-once'
66-import type { VitestExecutor } from './execute'
22+import type { SnapshotSerializer } from '@vitest/snapshot'
73import type { SerializedConfig } from './config'
44+import type { VitestExecutor } from './execute'
55+import { addSerializer } from '@vitest/snapshot'
66+import { setSafeTimers } from '@vitest/utils'
77+import { resetRunOnceCounter } from '../integrations/run-once'
8899let globalSetup = false
1010export async function setupCommonEnv(config: SerializedConfig) {
+8-8
packages/vitest/src/runtime/setup-node.ts
···11+import type { ResolvedTestEnvironment } from '../types/environment'
22+import type { SerializedConfig } from './config'
33+import type { VitestExecutor } from './execute'
14import { createRequire } from 'node:module'
22-import util from 'node:util'
35import timers from 'node:timers'
44-import { installSourcemapsSupport } from 'vite-node/source-map'
55-import { KNOWN_ASSET_TYPES } from 'vite-node/constants'
66+import util from 'node:util'
67import { getSafeTimers } from '@vitest/utils'
77-import * as VitestIndex from '../public/index'
88+import { KNOWN_ASSET_TYPES } from 'vite-node/constants'
99+import { installSourcemapsSupport } from 'vite-node/source-map'
810import { expect } from '../integrations/chai'
911import { resolveSnapshotEnvironment } from '../integrations/snapshot/environments/resolveSnapshotEnvironment'
1010-import type { ResolvedTestEnvironment } from '../types/environment'
1111-import { getWorkerState } from './utils'
1212+import * as VitestIndex from '../public/index'
1213import { setupCommonEnv } from './setup-common'
1313-import type { VitestExecutor } from './execute'
1414-import type { SerializedConfig } from './config'
1414+import { getWorkerState } from './utils'
15151616// this should only be used in Node
1717let globalSetup = false
+1-1
packages/vitest/src/runtime/utils.ts
···11import type { ModuleCacheMap } from 'vite-node/client'
2233-import { getSafeTimers } from '@vitest/utils'
43import type { WorkerGlobalState } from '../types/worker'
44+import { getSafeTimers } from '@vitest/utils'
5566const NAME_WORKER_STATE = '__vitest_worker__'
77
+3-3
packages/vitest/src/runtime/worker.ts
···11+import type { ContextRPC, WorkerGlobalState } from '../types/worker'
22+import type { VitestWorker } from './workers/types'
13import { pathToFileURL } from 'node:url'
24import { workerId as poolId } from 'tinypool'
35import { ModuleCacheMap } from 'vite-node/client'
46import { loadEnvironment } from '../integrations/env/loader'
55-import type { ContextRPC, WorkerGlobalState } from '../types/worker'
66-import { isChildProcess, setProcessTitle } from './utils'
77import { setupInspect } from './inspector'
88import { createRuntimeRpc, rpcDone } from './rpc'
99-import type { VitestWorker } from './workers/types'
99+import { isChildProcess, setProcessTitle } from './utils'
1010import { disposeInternalListeners } from './workers/utils'
11111212if (isChildProcess()) {
+5-5
packages/vitest/src/typecheck/collect.ts
···11-import { relative } from 'pathe'
22-import { parseAstAsync } from 'vite'
33-import { ancestor as walkAst } from 'acorn-walk'
11+import type { File, Suite, Test } from '@vitest/runner'
42import type { RawSourceMap } from 'vite-node'
33+import type { WorkspaceProject } from '../node/workspace'
54import {
65 calculateSuiteHash,
76 generateHash,
87 interpretTaskModes,
98 someTasksAreOnly,
109} from '@vitest/runner/utils'
1111-import type { File, Suite, Test } from '@vitest/runner'
1212-import type { WorkspaceProject } from '../node/workspace'
1010+import { ancestor as walkAst } from 'acorn-walk'
1111+import { relative } from 'pathe'
1212+import { parseAstAsync } from 'vite'
13131414interface ParsedFile extends File {
1515 start: number
+5-5
packages/vitest/src/typecheck/parse.ts
···11-import url from 'node:url'
22-import os from 'node:os'
33-import { writeFile } from 'node:fs/promises'
44-import { basename, dirname, join, resolve } from 'pathe'
55-import { getTsconfig as getTsconfigContent } from 'get-tsconfig'
61import type { TypecheckConfig } from '../node/types/config'
72import type { RawErrsMap, TscErrorInfo } from './types'
33+import { writeFile } from 'node:fs/promises'
44+import os from 'node:os'
55+import url from 'node:url'
66+import { getTsconfig as getTsconfigContent } from 'get-tsconfig'
77+import { basename, dirname, join, resolve } from 'pathe'
8899const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
1010const newLineRegExp = /\r?\n/
+12-12
packages/vitest/src/typecheck/typechecker.ts
···11-import { rm } from 'node:fs/promises'
22-import { performance } from 'node:perf_hooks'
33-import type { ChildProcess } from 'node:child_process'
44-import { basename, extname, resolve } from 'pathe'
55-import { TraceMap, generatedPositionFor } from '@vitest/utils/source-map'
61import type { RawSourceMap } from '@ampproject/remapping'
77-import type { ParsedStack } from '@vitest/utils'
82import type { File, Task, TaskResultPack, TaskState } from '@vitest/runner'
99-import { x } from 'tinyexec'
1010-import { getTasks } from '@vitest/runner/utils'
33+import type { ParsedStack } from '@vitest/utils'
44+import type { ChildProcess } from 'node:child_process'
55+import type { Vitest } from '../node/core'
116import type { WorkspaceProject } from '../node/workspace'
127import type { Awaitable } from '../types/general'
1313-import type { Vitest } from '../node/core'
88+import type { FileInformation } from './collect'
99+import type { TscErrorInfo } from './types'
1010+import { rm } from 'node:fs/promises'
1111+import { performance } from 'node:perf_hooks'
1212+import { getTasks } from '@vitest/runner/utils'
1313+import { generatedPositionFor, TraceMap } from '@vitest/utils/source-map'
1414+import { basename, extname, resolve } from 'pathe'
1515+import { x } from 'tinyexec'
1616+import { collectTests } from './collect'
1417import { getRawErrsMapFromTsCompile, getTsconfig } from './parse'
1518import { createIndexMap } from './utils'
1616-import type { FileInformation } from './collect'
1717-import { collectTests } from './collect'
1818-import type { TscErrorInfo } from './types'
19192020export class TypeCheckError extends Error {
2121 name = 'TypeCheckError'
+1-1
packages/vitest/src/types/global.ts
···11+import type { ExpectStatic, PromisifyAssertion, Tester } from '@vitest/expect'
12import type { Plugin as PrettyFormatPlugin } from '@vitest/pretty-format'
23import type { SnapshotState } from '@vitest/snapshot'
33-import type { ExpectStatic, PromisifyAssertion, Tester } from '@vitest/expect'
44import type { VitestEnvironment } from '../node/types/config'
55import type { BenchmarkResult } from '../runtime/types/benchmark'
66import type { UserConsoleLog } from './general'
+4-4
packages/vitest/src/types/worker.ts
···11-import type { ModuleCacheMap, ViteNodeResolveId } from 'vite-node'
22-import type { BirpcReturn } from 'birpc'
31import type { CancelReason, Task } from '@vitest/runner'
22+import type { BirpcReturn } from 'birpc'
33+import type { ModuleCacheMap, ViteNodeResolveId } from 'vite-node'
44import type { SerializedConfig } from '../runtime/config'
55-import type { RunnerRPC, RuntimeRPC } from './rpc'
66-import type { TransformMode } from './general'
75import type { Environment } from './environment'
66+import type { TransformMode } from './general'
77+import type { RunnerRPC, RuntimeRPC } from './rpc'
8899/** @deprecated unused */
1010export type ResolveIdFunction = (
+1-1
packages/vitest/src/utils/base.ts
···11-export { notNullish, getCallLastIndex, nanoid } from '@vitest/utils'
11+export { getCallLastIndex, nanoid, notNullish } from '@vitest/utils'
2233export function groupBy<T, K extends string | number | symbol>(
44 collection: T[],
+1-1
packages/vitest/src/utils/config-helpers.ts
···11-import type { SerializedConfig } from '../node/types/config'
21import type {
32 BenchmarkBuiltinReporters,
43 BuiltinReporters,
54} from '../node/reporters'
55+import type { SerializedConfig } from '../node/types/config'
6677const REGEXP_WRAP_PREFIX = '$$vitest:'
88
+6-6
packages/vitest/src/utils/coverage.ts
···11-import { existsSync, promises as fs, readdirSync, writeFileSync } from 'node:fs'
22-import { relative, resolve } from 'pathe'
33-import mm from 'micromatch'
44-import c from 'tinyrainbow'
51import type { CoverageMap } from 'istanbul-lib-coverage'
66-import { coverageConfigDefaults } from '../defaults'
77-import type { AfterSuiteRunMeta } from '../types/general'
82import type { Vitest } from '../node/core'
93import type { BaseCoverageOptions, ReportContext, ResolvedCoverageOptions } from '../node/types/coverage'
44+import type { AfterSuiteRunMeta } from '../types/general'
55+import { existsSync, promises as fs, readdirSync, writeFileSync } from 'node:fs'
66+import mm from 'micromatch'
77+import { relative, resolve } from 'pathe'
88+import c from 'tinyrainbow'
99+import { coverageConfigDefaults } from '../defaults'
1010import { resolveCoverageReporters } from '../node/config/resolveConfig'
11111212type Threshold = 'lines' | 'functions' | 'statements' | 'branches'
+1-1
packages/vitest/src/utils/memory-limit.ts
···55 * LICENSE file in the root directory of facebook/jest GitHub project tree.
66 */
7788-import * as nodeos from 'node:os'
98import type { ResolvedConfig } from '../node/types/config'
99+import * as nodeos from 'node:os'
10101111function getDefaultThreadsCount(config: ResolvedConfig) {
1212 const numCpus
···11-import { getTests } from '@vitest/runner/utils'
21import type { Suite, Task } from '@vitest/runner'
33-import { toArray } from '@vitest/utils'
42import type { Arrayable } from '../types/general'
33+import { getTests } from '@vitest/runner/utils'
44+import { toArray } from '@vitest/utils'
5566export function hasBenchmark(suite: Arrayable<Suite>): boolean {
77 return toArray(suite).some(s =>
+3-3
packages/vitest/src/utils/test-helpers.ts
···11-import { promises as fs } from 'node:fs'
22-import mm from 'micromatch'
11+import type { WorkspaceSpec } from '../node/pool'
32import type { EnvironmentOptions, TransformModePatterns, VitestEnvironment } from '../node/types/config'
43import type { ContextTestEnvironment } from '../types/worker'
55-import type { WorkspaceSpec } from '../node/pool'
44+import { promises as fs } from 'node:fs'
55+import mm from 'micromatch'
66import { groupBy } from './base'
7788export const envsOrder = ['node', 'jsdom', 'happy-dom', 'edge-runtime']
+1-1
test/core/test/mocking/automocking.spec.ts
···11-import { expect, test, vi } from 'vitest'
21import type * as exampleModule from '../../src/mocks/example'
22+import { expect, test, vi } from 'vitest'
33import log from '../../src/mocks/log'
44import { A } from '../../src/mocks/moduleA'
55import { methodSymbol, moduleWithSymbol } from '../../src/mocks/moduleWithSymbol'
+1-1
test/core/test/mocking/autospying.test.ts
···11-import { expect, test, vi } from 'vitest'
21import axios from 'axios'
22+import { expect, test, vi } from 'vitest'
33import { getAuthToken } from '../../src/env'
4455vi.mock(import('../../src/env'), { spy: true })
+1-1
test/core/test/mocking/circular-mocks.spec.ts
···11import { expect, test, vi } from 'vitest'
22+import x from '../../src/mocks/export-default-circle-index.js'
23// @ts-expect-error not typed
34import { main, mainB } from '../../src/mocks/main.js'
44-import x from '../../src/mocks/export-default-circle-index.js'
5566vi.mock('../../src/mocks/A', async () => ({
77 ...(await vi.importActual<any>('../../src/mocks/A')),
+1-1
test/core/test/mocking/destructured.test.ts
···11import { expect, test, vi } from 'vitest'
22+import { foo } from '../../src/mocks/set-foo.js'
23// @ts-expect-error mocked module
34import * as squaredModule from '../../src/mocks/squared'
45// @ts-expect-error mocked module
56import { squared } from '../../src/mocks/squared'
66-import { foo } from '../../src/mocks/set-foo.js'
7788vi.mock('any')
99
+1-2
test/core/test/mocking/error-mock.spec.ts
···55})
6677test('when using top level variable, gives helpful message', async () => {
88- await expect(() => import('../../src/mocks/default').then(m => m.default)).rejects
99- .toThrowErrorMatchingInlineSnapshot(`[Error: [vitest] There was an error when mocking a module. If you are using "vi.mock" factory, make sure there are no top level variables inside, since this call is hoisted to top of the file. Read more: https://vitest.dev/api/vi.html#vi-mock]`)
88+ await expect(() => import('../../src/mocks/default').then(m => m.default)).rejects.toThrowErrorMatchingInlineSnapshot(`[Error: [vitest] There was an error when mocking a module. If you are using "vi.mock" factory, make sure there are no top level variables inside, since this call is hoisted to top of the file. Read more: https://vitest.dev/api/vi.html#vi-mock]`)
109})
+2-1
test/core/test/mocking/external.test.ts
···11-import '../../src/mocks/external/external.mjs'
11+/* eslint-disable perfectionist/sort-imports */
22import { expect, test, vi } from 'vitest'
33+import '../../src/mocks/external/external.mjs'
34import axios from 'axios'
45// @ts-expect-error mocked module
56import defaultFunc from '../../src/mocks/external/default-function.cjs'
+2-3
test/core/test/mocking/factory.test.ts
···11import axios from 'axios'
22import { describe, expect, it, test, vi } from 'vitest'
33import * as example from '../../src/mocks/example'
44+import logger from '../../src/mocks/log'
45import * as moduleA from '../../src/mocks/moduleA'
56import * as moduleB from '../../src/mocks/moduleB'
66-import logger from '../../src/mocks/log'
7788vi
99 .mock('../../src/mocks/example', () => ({
···6767 })
68686969 it('non-object return on factory gives error', async () => {
7070- await expect(() => import('../../src/mocks/default.js').then(m => m.default)).rejects
7171- .toThrowError('[vitest] vi.mock("../../src/mocks/default.ts", factory?: () => unknown) is not returning an object. Did you mean to return an object with a "default" key?')
7070+ await expect(() => import('../../src/mocks/default.js').then(m => m.default)).rejects.toThrowError('[vitest] vi.mock("../../src/mocks/default.ts", factory?: () => unknown) is not returning an object. Did you mean to return an object with a "default" key?')
7271 })
73727473 test('defined exports on mock', async () => {
+1-1
test/core/test/mocking/self-importing.test.ts
···11-import zustand from 'zustand'
21import { describe, expect, test, vi } from 'vitest'
22+import zustand from 'zustand'
33import { magic } from '../../src/mocks/zustand-magic'
4455vi.mock('zustand')
···11-import React from 'react'
22-import { expect, test } from 'vitest'
31import { render, screen } from '@testing-library/react'
42import { userEvent } from '@testing-library/user-event'
33+import React from 'react'
44+import { expect, test } from 'vitest'
55import Link from '../components/Link.jsx'
6677test('Link changes the state when hovered', async () => {
···11-import { afterAll, expect, test } from 'vitest'
21import supertest from 'supertest'
22+import { afterAll, expect, test } from 'vitest'
3344-import app from '../src/app'
54import { usersData } from '../mockData'
55+import app from '../src/app'
6677test('with HTTP injection', async () => {
88 const response = await app.inject({
+2-2
packages/browser/src/client/tester/context.ts
···11-import type { RunnerTask } from 'vitest'
22-import type { BrowserRPC } from '@vitest/browser/client'
31import type { Options as TestingLibraryOptions, UserEvent as TestingLibraryUserEvent } from '@testing-library/user-event'
22+import type { BrowserRPC } from '@vitest/browser/client'
33+import type { RunnerTask } from 'vitest'
44import type {
55 BrowserPage,
66 Locator,
···11-import * as matchers from '@testing-library/jest-dom/matchers'
21import type { Locator } from '@vitest/browser/context'
32import type { ExpectPollOptions } from 'vitest'
33+import * as matchers from '@testing-library/jest-dom/matchers'
44import { chai, expect } from 'vitest'
5566export async function setupExpectDom() {
+1-1
packages/browser/src/client/tester/msw.ts
···11-import { channel } from '@vitest/browser/client'
21import type {
32 IframeChannelEvent,
43 IframeMockFactoryRequestEvent,
54 IframeMockingDoneEvent,
65} from '@vitest/browser/client'
76import type { MockedModuleSerialized } from '@vitest/mocker'
77+import { channel } from '@vitest/browser/client'
88import { ManualMockedModule } from '@vitest/mocker'
99import { ModuleMockerMSWInterceptor } from '@vitest/mocker/browser'
1010import { nanoid } from '@vitest/utils'
···11import { type Locator, type LocatorSelectors, page } from '@vitest/browser/context'
22-import { type StringifyOptions, stringify } from 'vitest/utils'
32import { asLocator } from 'ivya'
33+import { stringify, type StringifyOptions } from 'vitest/utils'
4455export function getElementLocatorSelectors(element: Element): LocatorSelectors {
66 const locator = page.elementLocator(element)
+1-1
packages/browser/src/client/tester/rpc.ts
···11-import { getSafeTimers } from 'vitest/utils'
21import type { VitestBrowserClient } from '@vitest/browser/client'
22+import { getSafeTimers } from 'vitest/utils'
3344const { get } = Reflect
55
+8-8
packages/browser/src/client/tester/runner.ts
···11import type { CancelReason, File, Suite, Task, TaskResultPack, VitestRunner } from '@vitest/runner'
22import type { SerializedConfig, WorkerGlobalState } from 'vitest'
33import type { VitestExecutor } from 'vitest/execute'
44-import { NodeBenchmarkRunner, VitestTestRunner } from 'vitest/runners'
55-import { loadDiffConfig, loadSnapshotSerializers, takeCoverageInsideWorker } from 'vitest/browser'
66-import { TraceMap, originalPositionFor } from 'vitest/utils'
77-import { page, userEvent } from '@vitest/browser/context'
88-import { globalChannel } from '@vitest/browser/client'
99-import { executor } from '../utils'
1010-import { VitestBrowserSnapshotEnvironment } from './snapshot'
1111-import { rpc } from './rpc'
124import type { VitestBrowserClientMocker } from './mocker'
55+import { globalChannel } from '@vitest/browser/client'
66+import { page, userEvent } from '@vitest/browser/context'
77+import { loadDiffConfig, loadSnapshotSerializers, takeCoverageInsideWorker } from 'vitest/browser'
88+import { NodeBenchmarkRunner, VitestTestRunner } from 'vitest/runners'
99+import { originalPositionFor, TraceMap } from 'vitest/utils'
1010+import { executor } from '../utils'
1111+import { rpc } from './rpc'
1212+import { VitestBrowserSnapshotEnvironment } from './snapshot'
13131414interface BrowserRunnerOptions {
1515 config: SerializedConfig
+2-2
packages/browser/src/client/tester/snapshot.ts
···11-import type { SnapshotEnvironment } from 'vitest/snapshot'
22-import { type ParsedStack, TraceMap, originalPositionFor } from 'vitest/utils'
31import type { VitestBrowserClient } from '@vitest/browser/client'
22+import type { SnapshotEnvironment } from 'vitest/snapshot'
33+import { originalPositionFor, type ParsedStack, TraceMap } from 'vitest/utils'
4455export class VitestBrowserSnapshotEnvironment implements SnapshotEnvironment {
66 private sourceMaps = new Map<string, any>()
+1-1
packages/browser/src/client/tester/state.ts
···11+import type { BrowserRPC } from '@vitest/browser/client'
12import type { WorkerGlobalState } from 'vitest'
23import { parse } from 'flatted'
33-import type { BrowserRPC } from '@vitest/browser/client'
44import { getBrowserState } from '../utils'
5566const config = getBrowserState().config
+4-4
packages/browser/src/client/tester/tester.ts
···11-import { SpyModule, collectTests, setupCommonEnv, startCoverageInsideWorker, startTests, stopCoverageInsideWorker } from 'vitest/browser'
22-import { page, userEvent } from '@vitest/browser/context'
31import type { IframeMockEvent, IframeMockInvalidateEvent, IframeUnmockEvent } from '@vitest/browser/client'
42import { channel, client, onCancel, waitForChannel } from '@vitest/browser/client'
33+import { page, userEvent } from '@vitest/browser/context'
44+import { collectTests, setupCommonEnv, SpyModule, startCoverageInsideWorker, startTests, stopCoverageInsideWorker } from 'vitest/browser'
55import { executor, getBrowserState, getConfig, getWorkerState } from '../utils'
66import { setupDialogsSpy } from './dialog'
77+import { setupExpectDom } from './expect-element'
78import { setupConsoleLogSpy } from './logger'
99+import { VitestBrowserClientMocker } from './mocker'
810import { createSafeRpc } from './rpc'
911import { browserHashMap, initiateRunner } from './runner'
1010-import { VitestBrowserClientMocker } from './mocker'
1111-import { setupExpectDom } from './expect-element'
12121313const cleanupSymbol = Symbol.for('vitest:component-cleanup')
1414
+1-1
packages/browser/src/node/commands/clear.ts
···11import type { UserEvent } from '../../../context'
22+import type { UserEventCommand } from './utils'
23import { PlaywrightBrowserProvider } from '../providers/playwright'
34import { WebdriverBrowserProvider } from '../providers/webdriver'
44-import type { UserEventCommand } from './utils'
5566export const clear: UserEventCommand<UserEvent['clear']> = async (
77 context,
+1-1
packages/browser/src/node/commands/click.ts
···11import type { UserEvent } from '../../../context'
22+import type { UserEventCommand } from './utils'
23import { PlaywrightBrowserProvider } from '../providers/playwright'
34import { WebdriverBrowserProvider } from '../providers/webdriver'
44-import type { UserEventCommand } from './utils'
5566export const click: UserEventCommand<UserEvent['click']> = async (
77 context,
+1-1
packages/browser/src/node/commands/dragAndDrop.ts
···11import type { UserEvent } from '../../../context'
22+import type { UserEventCommand } from './utils'
23import { PlaywrightBrowserProvider } from '../providers/playwright'
34import { WebdriverBrowserProvider } from '../providers/webdriver'
44-import type { UserEventCommand } from './utils'
5566export const dragAndDrop: UserEventCommand<UserEvent['dragAndDrop']> = async (
77 context,
+1-1
packages/browser/src/node/commands/fill.ts
···11import type { UserEvent } from '../../../context'
22+import type { UserEventCommand } from './utils'
23import { PlaywrightBrowserProvider } from '../providers/playwright'
34import { WebdriverBrowserProvider } from '../providers/webdriver'
44-import type { UserEventCommand } from './utils'
5566export const fill: UserEventCommand<UserEvent['fill']> = async (
77 context,
+3-3
packages/browser/src/node/commands/fs.ts
···11+import type { BrowserCommand, WorkspaceProject } from 'vitest/node'
22+import type { BrowserCommands } from '../../../context'
13import fs, { promises as fsp } from 'node:fs'
24import { basename, dirname, resolve } from 'node:path'
33-import { isFileServingAllowed } from 'vitest/node'
44-import type { BrowserCommand, WorkspaceProject } from 'vitest/node'
55import mime from 'mime/lite'
66-import type { BrowserCommands } from '../../../context'
66+import { isFileServingAllowed } from 'vitest/node'
7788function assertFileAccess(path: string, project: WorkspaceProject) {
99 if (
+1-1
packages/browser/src/node/commands/hover.ts
···11import type { UserEvent } from '../../../context'
22+import type { UserEventCommand } from './utils'
23import { PlaywrightBrowserProvider } from '../providers/playwright'
34import { WebdriverBrowserProvider } from '../providers/webdriver'
44-import type { UserEventCommand } from './utils'
5566export const hover: UserEventCommand<UserEvent['hover']> = async (
77 context,
+8-8
packages/browser/src/node/commands/index.ts
···11-import { click, dblClick, tripleClick } from './click'
22-import { type } from './type'
31import { clear } from './clear'
44-import { fill } from './fill'
55-import { selectOptions } from './select'
66-import { tab } from './tab'
77-import { keyboard, keyboardCleanup } from './keyboard'
22+import { click, dblClick, tripleClick } from './click'
83import { dragAndDrop } from './dragAndDrop'
99-import { hover } from './hover'
1010-import { upload } from './upload'
44+import { fill } from './fill'
115import {
126 _fileInfo,
137 readFile,
148 removeFile,
159 writeFile,
1610} from './fs'
1111+import { hover } from './hover'
1212+import { keyboard, keyboardCleanup } from './keyboard'
1713import { screenshot } from './screenshot'
1414+import { selectOptions } from './select'
1515+import { tab } from './tab'
1616+import { type } from './type'
1717+import { upload } from './upload'
18181919export default {
2020 readFile,
+3-3
packages/browser/src/node/commands/keyboard.ts
···11-import { parseKeyDef } from '@testing-library/user-event/dist/esm/keyboard/parseKeyDef.js'
22-import { defaultKeyMap } from '@testing-library/user-event/dist/esm/keyboard/keyMap.js'
31import type { BrowserProvider } from 'vitest/node'
22+import type { UserEventCommand } from './utils'
33+import { defaultKeyMap } from '@testing-library/user-event/dist/esm/keyboard/keyMap.js'
44+import { parseKeyDef } from '@testing-library/user-event/dist/esm/keyboard/parseKeyDef.js'
45import { PlaywrightBrowserProvider } from '../providers/playwright'
56import { WebdriverBrowserProvider } from '../providers/webdriver'
66-import type { UserEventCommand } from './utils'
7788export interface KeyboardState {
99 unreleased: string[]
+2-2
packages/browser/src/node/commands/screenshot.ts
···11+import type { BrowserCommand, ResolvedConfig } from 'vitest/node'
22+import type { ScreenshotOptions } from '../../../context'
13import { mkdir } from 'node:fs/promises'
24import { normalize } from 'node:path'
33-import type { BrowserCommand, ResolvedConfig } from 'vitest/node'
45import { basename, dirname, relative, resolve } from 'pathe'
55-import type { ScreenshotOptions } from '../../../context'
66import { PlaywrightBrowserProvider } from '../providers/playwright'
77import { WebdriverBrowserProvider } from '../providers/webdriver'
88
+1-1
packages/browser/src/node/commands/select.ts
···11import type { ElementHandle } from 'playwright'
22import type { UserEvent } from '../../../context'
33+import type { UserEventCommand } from './utils'
34import { PlaywrightBrowserProvider } from '../providers/playwright'
45import { WebdriverBrowserProvider } from '../providers/webdriver'
55-import type { UserEventCommand } from './utils'
6677export const selectOptions: UserEventCommand<UserEvent['selectOptions']> = async (
88 context,
+1-1
packages/browser/src/node/commands/tab.ts
···11import type { UserEvent } from '../../../context'
22+import type { UserEventCommand } from './utils'
23import { PlaywrightBrowserProvider } from '../providers/playwright'
34import { WebdriverBrowserProvider } from '../providers/webdriver'
44-import type { UserEventCommand } from './utils'
5566export const tab: UserEventCommand<UserEvent['tab']> = async (
77 context,
+1-1
packages/browser/src/node/commands/type.ts
···11import type { UserEvent } from '../../../context'
22+import type { UserEventCommand } from './utils'
23import { PlaywrightBrowserProvider } from '../providers/playwright'
34import { WebdriverBrowserProvider } from '../providers/webdriver'
44-import type { UserEventCommand } from './utils'
55import { keyboardImplementation } from './keyboard'
6677export const type: UserEventCommand<UserEvent['type']> = async (
+1-1
packages/browser/src/node/commands/upload.ts
···11+import type { UserEventCommand } from './utils'
12import { dirname, resolve } from 'pathe'
23import { PlaywrightBrowserProvider } from '../providers/playwright'
34import { WebdriverBrowserProvider } from '../providers/webdriver'
44-import type { UserEventCommand } from './utils'
5566export const upload: UserEventCommand<(element: string, files: Array<string | {
77 name: string
···11-import { fileURLToPath } from 'node:url'
11+import type { PluginContext } from 'rollup'
22import type { Plugin } from 'vitest/config'
33import type { BrowserProvider } from 'vitest/node'
44-import { dirname, resolve } from 'pathe'
55-import type { PluginContext } from 'rollup'
66-import { slash } from '@vitest/utils'
77-import builtinCommands from '../commands/index'
84import type { BrowserServer } from '../server'
55+import { fileURLToPath } from 'node:url'
66+import { slash } from '@vitest/utils'
77+import { dirname, resolve } from 'pathe'
88+import builtinCommands from '../commands/index'
991010const VIRTUAL_ID_CONTEXT = '\0@vitest/browser/context'
1111const ID_CONTEXT = '@vitest/browser/context'
+1-1
packages/browser/src/node/providers/index.ts
···11import { PlaywrightBrowserProvider } from './playwright'
22-import { WebdriverBrowserProvider } from './webdriver'
32import { PreviewBrowserProvider } from './preview'
33+import { WebdriverBrowserProvider } from './webdriver'
4455export const webdriverio = WebdriverBrowserProvider
66export const playwright = PlaywrightBrowserProvider
···11<script setup lang="ts">
22import type { Task, TaskState } from '@vitest/runner'
33-import { nextTick } from 'vue'
43import { hasFailedSnapshot } from '@vitest/ws-client'
54import { Tooltip as VueTooltip } from 'floating-vue'
55+import { nextTick } from 'vue'
66import { client, isReport, runFiles } from '~/composables/client'
77-import { coverageEnabled } from '~/composables/navigation'
88-import type { TaskTreeNodeType } from '~/composables/explorer/types'
77+import { showSource } from '~/composables/codemirror'
98import { explorerTree } from '~/composables/explorer'
109import { escapeHtml, highlightRegex } from '~/composables/explorer/state'
1111-import { showSource } from '~/composables/codemirror'
1010+import type { TaskTreeNodeType } from '~/composables/explorer/types'
1111+import { coverageEnabled } from '~/composables/navigation'
12121313// TODO: better handling of "opened" - it means to forcefully open the tree item and set in TasksList right now
1414const {
···11-import { faker } from '@faker-js/faker'
21import type { File } from 'vitest'
22+import { faker } from '@faker-js/faker'
33import { beforeEach, describe, expect, it } from 'vitest'
44-import ViewReport from './ViewReport.vue'
55-import { render, screen, within } from '~/test'
64import { config } from '~/composables/client'
55+import { render, screen, within } from '~/test'
66+import ViewReport from './ViewReport.vue'
7788config.value.root = ''
99
···11<script setup lang="ts">
22-import type { ErrorWithDiff, File, Suite, Task } from 'vitest'
32import type Convert from 'ansi-to-html'
33+import type { ErrorWithDiff, File, Suite, Task } from 'vitest'
44+import { browserState, config } from '~/composables/client'
45import { isDark } from '~/composables/dark'
56import { createAnsiToHtmlFilter } from '~/composables/error'
66-import { browserState, config } from '~/composables/client'
77import { escapeHtml } from '~/utils/escape'
8899const props = defineProps<{
+8-8
packages/ui/client/composables/client/index.ts
···11-import { createClient, getTasks } from '@vitest/ws-client'
21import type { WebSocketStatus } from '@vueuse/core'
32import type { File, SerializedConfig, TaskResultPack } from 'vitest'
44-import { reactive as reactiveVue } from 'vue'
55-import { createFileTask } from '@vitest/runner/utils'
63import type { BrowserRunnerState } from '../../../types'
44+import { createFileTask } from '@vitest/runner/utils'
55+import { createClient, getTasks } from '@vitest/ws-client'
66+import { reactive as reactiveVue } from 'vue'
77+import { explorerTree } from '~/composables/explorer'
88+import { isFileNode } from '~/composables/explorer/utils'
99+import { ui } from '../../composables/api'
710import { ENTRY_URL, isReport } from '../../constants'
811import { parseError } from '../error'
912import { activeFileId } from '../params'
1010-import { ui } from '../../composables/api'
1111-import { createStaticClient } from './static'
1213import { testRunState, unhandledErrors } from './state'
1313-import { explorerTree } from '~/composables/explorer'
1414-import { isFileNode } from '~/composables/explorer/utils'
1414+import { createStaticClient } from './static'
15151616-export { ENTRY_URL, PORT, HOST, isReport } from '../../constants'
1616+export { ENTRY_URL, HOST, isReport, PORT } from '../../constants'
17171818export const client = (function createVitestClient() {
1919 if (isReport) {
+1-1
packages/ui/client/composables/client/state.ts
···11-import type { Ref } from 'vue'
21import type { ErrorWithDiff } from '@vitest/utils'
22+import type { Ref } from 'vue'
33import type { RunState } from '../../../types'
4455export const testRunState: Ref<RunState> = ref('idle')
+2-2
packages/ui/client/composables/client/static.ts
···11-import type { BirpcReturn } from 'birpc'
21import type { VitestClient } from '@vitest/ws-client'
22+import type { BirpcReturn } from 'birpc'
33import type {
44 File,
55 ModuleGraphData,
···77 WebSocketEvents,
88 WebSocketHandlers,
99} from 'vitest'
1010-import { parse } from 'flatted'
1110import { decompressSync, strFromU8 } from 'fflate'
1111+import { parse } from 'flatted'
1212import { StateManager } from '../../../../ws-client/src/state'
13131414interface HTMLReportMetadata {
···11import type { Custom, File, Task, TaskResultPack, Test } from '@vitest/runner'
22-import { isAtomTest } from '@vitest/runner/utils'
32import type { Arrayable } from '@vitest/utils'
33+import { isAtomTest } from '@vitest/runner/utils'
44import { toArray } from '@vitest/utils'
55import { hasFailedSnapshot } from '@vitest/ws-client'
66-import type { CollectFilteredTests, CollectorInfo, Filter, FilteredTests } from '~/composables/explorer/types'
76import { client, findById } from '~/composables/client'
77+import { expandNodesOnEndRun } from '~/composables/explorer/expand'
88import { runFilter, testMatcher } from '~/composables/explorer/filter'
99-import {
1010- createOrUpdateFileNode,
1111- createOrUpdateNodeTask,
1212- createOrUpdateSuiteTask,
1313- isRunningTestNode,
1414-} from '~/composables/explorer/utils'
1515-import { isSuite } from '~/utils/task'
99+import { explorerTree } from '~/composables/explorer/index'
1610import {
1711 initialized,
1812 openedTreeItems,
···2014 uiEntries,
2115 uiFiles,
2216} from '~/composables/explorer/state'
2323-import { explorerTree } from '~/composables/explorer/index'
2424-import { expandNodesOnEndRun } from '~/composables/explorer/expand'
1717+import type { CollectFilteredTests, CollectorInfo, Filter, FilteredTests } from '~/composables/explorer/types'
1818+import {
1919+ createOrUpdateFileNode,
2020+ createOrUpdateNodeTask,
2121+ createOrUpdateSuiteTask,
2222+ isRunningTestNode,
2323+} from '~/composables/explorer/utils'
2424+import { isSuite } from '~/utils/task'
25252626export function runLoadFiles(
2727 remoteFiles: File[],
+3-3
packages/ui/client/composables/explorer/expand.ts
···11+import { findById } from '~/composables/client'
22+import { filterAll, filterNode } from '~/composables/explorer/filter'
33+import { explorerTree } from '~/composables/explorer/index'
14import { filteredFiles, openedTreeItems, treeFilter, uiEntries } from '~/composables/explorer/state'
25import type { Filter, UITaskTreeNode } from '~/composables/explorer/types'
36import { createOrUpdateNode, createOrUpdateSuiteTask, isFileNode, isParentNode } from '~/composables/explorer/utils'
44-import { filterAll, filterNode } from '~/composables/explorer/filter'
55-import { findById } from '~/composables/client'
66-import { explorerTree } from '~/composables/explorer/index'
7788/**
99 * Expand the node: only direct children will be expanded
+4-4
packages/ui/client/composables/explorer/filter.ts
···11import type { Task } from '@vitest/runner'
22-import { caseInsensitiveMatch } from '~/utils/task'
22+import { client, findById } from '~/composables/client'
33+import { explorerTree } from '~/composables/explorer/index'
44+import { filteredFiles, uiEntries } from '~/composables/explorer/state'
35import type { FileTreeNode, Filter, FilterResult, ParentTreeNode, UITaskTreeNode } from '~/composables/explorer/types'
46import {
57 isFileNode,
···79 isTestNode,
810 sortedRootTasks,
911} from '~/composables/explorer/utils'
1010-import { client, findById } from '~/composables/client'
1111-import { filteredFiles, uiEntries } from '~/composables/explorer/state'
1212-import { explorerTree } from '~/composables/explorer/index'
1212+import { caseInsensitiveMatch } from '~/utils/task'
13131414export function testMatcher(task: Task, search: string, filter: Filter) {
1515 return task ? matchTask(task, search, filter) : false
+1-1
packages/ui/client/composables/explorer/search.ts
···11import type { Ref } from 'vue'
22+import { explorerTree } from '~/composables/explorer'
23import {
34 filter,
45 filteredFiles,
···1112 treeFilter,
1213 uiEntries,
1314} from './state'
1414-import { explorerTree } from '~/composables/explorer'
15151616export function useSearch(searchBox: Ref<HTMLDivElement | undefined>) {
1717 const disableFilter = computed(() => {
+4-4
packages/ui/client/composables/explorer/tree.ts
···11import type { File, TaskResultPack } from '@vitest/runner'
22+import { runCollapseAllTask, runCollapseNode } from '~/composables/explorer/collapse'
33+import { collectTestsTotalData, preparePendingTasks, runCollect, runLoadFiles } from '~/composables/explorer/collector'
44+import { runExpandAll, runExpandNode } from '~/composables/explorer/expand'
55+import { runFilter } from '~/composables/explorer/filter'
26import {
37 filter,
48 search,
···913 RootTreeNode,
1014 UITaskTreeNode,
1115} from '~/composables/explorer/types'
1212-import { collectTestsTotalData, preparePendingTasks, runCollect, runLoadFiles } from '~/composables/explorer/collector'
1313-import { runCollapseAllTask, runCollapseNode } from '~/composables/explorer/collapse'
1414-import { runExpandAll, runExpandNode } from '~/composables/explorer/expand'
1515-import { runFilter } from '~/composables/explorer/filter'
16161717export class ExplorerTree {
1818 private rafCollector: ReturnType<typeof useRafFn>
+3-3
packages/ui/client/composables/explorer/utils.ts
···11import type { File, Task } from '@vitest/runner'
22import { isAtomTest } from '@vitest/runner/utils'
33+import { client } from '~/composables/client'
44+import { explorerTree } from '~/composables/explorer/index'
55+import { openedTreeItemsSet } from '~/composables/explorer/state'
36import type {
47 CustomTestTreeNode,
58 FileTreeNode,
···811 TestTreeNode,
912 UITaskTreeNode,
1013} from '~/composables/explorer/types'
1111-import { client } from '~/composables/client'
1214import { getProjectNameColor, isSuite as isTaskSuite } from '~/utils/task'
1313-import { explorerTree } from '~/composables/explorer/index'
1414-import { openedTreeItemsSet } from '~/composables/explorer/state'
15151616export function isTestNode(node: UITaskTreeNode): node is TestTreeNode | CustomTestTreeNode {
1717 return node.type === 'test' || node.type === 'custom'
+5-5
packages/vitest/src/create/browser/creator.ts
···11-import { dirname, relative, resolve } from 'node:path'
11+import type { Agent } from '@antfu/install-pkg'
22+import type { BrowserBuiltinProvider } from '../../node/types/browser'
23import { existsSync, readFileSync } from 'node:fs'
34import { writeFile } from 'node:fs/promises'
44-import prompt from 'prompts'
55-import c from 'tinyrainbow'
66-import type { Agent } from '@antfu/install-pkg'
55+import { dirname, relative, resolve } from 'node:path'
76import { detectPackageManager, installPackage } from '@antfu/install-pkg'
87import { findUp } from 'find-up'
88+import prompt from 'prompts'
99import { x } from 'tinyexec'
1010-import type { BrowserBuiltinProvider } from '../../node/types/browser'
1010+import c from 'tinyrainbow'
1111import { configFiles } from '../../constants'
1212import { generateExampleFiles } from './examples'
1313
+6-6
packages/vitest/src/integrations/chai/index.ts
···11// CI failes only for this file, but it works locally
2233-import * as chai from 'chai'
44-import './setup'
33+import type { Assertion, ExpectStatic, MatcherState } from '@vitest/expect'
54import type { TaskPopulated, Test } from '@vitest/runner'
66-import { getCurrentTest } from '@vitest/runner'
75import {
88- ASYMMETRIC_MATCHERS_OBJECT,
99- GLOBAL_EXPECT,
106 addCustomEqualityTesters,
77+ ASYMMETRIC_MATCHERS_OBJECT,
118 getState,
99+ GLOBAL_EXPECT,
1210 setState,
1311} from '@vitest/expect'
1414-import type { Assertion, ExpectStatic, MatcherState } from '@vitest/expect'
1212+import { getCurrentTest } from '@vitest/runner'
1513import { getTestName } from '@vitest/runner/utils'
1414+import * as chai from 'chai'
1615import { getCurrentEnvironment, getWorkerState } from '../../runtime/utils'
1716import { createExpectPoll } from './poll'
1717+import './setup'
18181919export function createExpect(test?: TaskPopulated) {
2020 const expect = ((value: any, message?: string): Assertion => {
+1-1
packages/vitest/src/integrations/chai/poll.ts
···11-import * as chai from 'chai'
21import type { Assertion, ExpectStatic } from '@vitest/expect'
32import { getSafeTimers } from '@vitest/utils'
33+import * as chai from 'chai'
44import { getWorkerState } from '../../runtime/utils'
5566// these matchers are not supported because they don't make sense with poll
+2-2
packages/vitest/src/integrations/chai/setup.ts
···11-import * as chai from 'chai'
22-import Subset from 'chai-subset'
31import {
42 JestAsymmetricMatchers,
53 JestChaiExpect,
64 JestExtend,
75} from '@vitest/expect'
66+import * as chai from 'chai'
77+import Subset from 'chai-subset'
88import { SnapshotPlugin } from '../snapshot/chai'
991010chai.use(JestExtend)
···11import type { Environment } from '../../types/environment'
22-import { populateGlobal } from './utils'
32import { KEYS } from './jsdom-keys'
33+import { populateGlobal } from './utils'
4455export default <Environment>{
66 name: 'edge-runtime',
+3-3
packages/vitest/src/integrations/env/index.ts
···11-import node from './node'
22-import jsdom from './jsdom'
33-import happy from './happy-dom'
41import edge from './edge-runtime'
22+import happy from './happy-dom'
33+import jsdom from './jsdom'
44+import node from './node'
5566export const environments = {
77 node,
+4-4
packages/vitest/src/integrations/env/loader.ts
···11+import type { ViteNodeRunnerOptions } from 'vite-node'
22+import type { BuiltinEnvironment, VitestEnvironment } from '../../node/types/config'
33+import type { Environment } from '../../types/environment'
44+import type { ContextRPC, WorkerRPC } from '../../types/worker'
15import { readFileSync } from 'node:fs'
26import { normalize, resolve } from 'pathe'
37import { ViteNodeRunner } from 'vite-node/client'
44-import type { ViteNodeRunnerOptions } from 'vite-node'
55-import type { BuiltinEnvironment, VitestEnvironment } from '../../node/types/config'
66-import type { ContextRPC, WorkerRPC } from '../../types/worker'
77-import type { Environment } from '../../types/environment'
88import { environments } from './index'
991010function isBuiltinEnvironment(
+1-1
packages/vitest/src/integrations/env/node.ts
···11-import { Console } from 'node:console'
21import type { Environment } from '../../types/environment'
22+import { Console } from 'node:console'
3344// some globals we do not want, either because deprecated or we set it ourselves
55const denyList = new Set([
+1-1
packages/vitest/src/integrations/mock/timers.ts
···1212} from '@sinonjs/fake-timers'
1313import { withGlobal } from '@sinonjs/fake-timers'
1414import { isChildProcess } from '../../runtime/utils'
1515-import { RealDate, mockDate, resetDate } from './date'
1515+import { mockDate, RealDate, resetDate } from './date'
16161717export class FakeTimers {
1818 private _global: typeof globalThis
+3-3
packages/vitest/src/integrations/snapshot/chai.ts
···11import type { ChaiPlugin } from '@vitest/expect'
22+import type { Test } from '@vitest/runner'
23import { equals, iterableEquality, subsetEquality } from '@vitest/expect'
44+import { getNames } from '@vitest/runner/utils'
35import {
44- SnapshotClient,
56 addSerializer,
77+ SnapshotClient,
68 stripSnapshotIndentation,
79} from '@vitest/snapshot'
88-import type { Test } from '@vitest/runner'
99-import { getNames } from '@vitest/runner/utils'
1010import { recordAsyncExpect } from '../../../../expect/src/utils'
11111212let _client: SnapshotClient
+2-2
packages/vitest/src/node/cache/files.ts
···11-import fs from 'node:fs'
21import type { Stats } from 'node:fs'
33-import { relative } from 'pathe'
42import type { WorkspaceSpec } from '../pool'
33+import fs from 'node:fs'
44+import { relative } from 'pathe'
5566type FileStatsCache = Pick<Stats, 'size'>
77
+1-1
packages/vitest/src/node/cache/index.ts
···11-import { resolve } from 'pathe'
21import { slash } from '@vitest/utils'
22+import { resolve } from 'pathe'
33import { hash } from '../hash'
44import { FilesStatsCache } from './files'
55import { ResultsCache } from './results'
+2-2
packages/vitest/src/node/cache/results.ts
···11-import fs from 'node:fs'
22-import { dirname, relative, resolve } from 'pathe'
31import type { File } from '@vitest/runner'
42import type { ResolvedConfig } from '../types/config'
33+import fs from 'node:fs'
44+import { dirname, relative, resolve } from 'pathe'
5566export interface SuiteResultCache {
77 failed: boolean
+5-5
packages/vitest/src/node/cli/cac.ts
···11-import { normalize } from 'pathe'
22-import cac, { type CAC, type Command } from 'cac'
33-import c from 'tinyrainbow'
44-import { toArray } from '@vitest/utils'
55-import { version } from '../../../package.json' with { type: 'json' }
61import type { VitestRunMode } from '../types/config'
72import type { CliOptions } from './cli-api'
83import type { CLIOption, CLIOptions as CLIOptionsConfig } from './cli-config'
44+import { toArray } from '@vitest/utils'
55+import cac, { type CAC, type Command } from 'cac'
66+import { normalize } from 'pathe'
77+import c from 'tinyrainbow'
88+import { version } from '../../../package.json' with { type: 'json' }
99import { benchCliOptionsConfig, cliOptionsConfig, collectCliOptionsConfig } from './cli-config'
10101111function addCommand(cli: CAC | Command, name: string, option: CLIOption<any>) {
+9-11
packages/vitest/src/node/cli/cli-api.ts
···11-/* eslint-disable no-console */
22-33-import { mkdirSync, writeFileSync } from 'node:fs'
44-import { dirname, relative, resolve } from 'pathe'
55-import type { UserConfig as ViteUserConfig } from 'vite'
61import type { File, Suite, Task } from '@vitest/runner'
77-import { getNames, getTests } from '@vitest/runner/utils'
88-import { CoverageProviderMap } from '../../integrations/coverage'
22+import type { UserConfig as ViteUserConfig } from 'vite'
93import type { environments } from '../../integrations/env'
1010-import { createVitest } from '../create'
1111-import { registerConsoleShortcuts } from '../stdin'
124import type { Vitest, VitestOptions } from '../core'
1313-import { FilesNotFoundError, GitNotFoundError } from '../errors'
1414-import type { UserConfig, VitestEnvironment, VitestRunMode } from '../types/config'
155import type { WorkspaceSpec } from '../pool'
66+import type { UserConfig, VitestEnvironment, VitestRunMode } from '../types/config'
77+import { mkdirSync, writeFileSync } from 'node:fs'
88+import { getNames, getTests } from '@vitest/runner/utils'
99+import { dirname, relative, resolve } from 'pathe'
1010+import { CoverageProviderMap } from '../../integrations/coverage'
1111+import { createVitest } from '../create'
1212+import { FilesNotFoundError, GitNotFoundError } from '../errors'
1313+import { registerConsoleShortcuts } from '../stdin'
16141715export interface CliOptions extends UserConfig {
1816 /**
+1-1
packages/vitest/src/node/cli/cli-config.ts
···11-import { defaultBrowserPort, defaultPort } from '../../constants'
21import type { ApiConfig } from '../types/config'
32import type {
43 ForksOptions,
···76 WorkerContextOptions,
87} from '../types/pool-options'
98import type { CliOptions } from './cli-api'
99+import { defaultBrowserPort, defaultPort } from '../../constants'
10101111type NestedOption<T, V = Extract<T, Record<string, any>>> = V extends
1212| never
+10-10
packages/vitest/src/node/config/resolveConfig.ts
···11-import { resolveModule } from 'local-pkg'
22-import { normalize, relative, resolve } from 'pathe'
33-import c from 'tinyrainbow'
41import type { ResolvedConfig as ResolvedViteConfig } from 'vite'
55-import { toArray } from '@vitest/utils'
66-import { isCI, stdProvider } from '../../utils/env'
22+import type { Logger } from '../logger'
33+import type { BenchmarkBuiltinReporters } from '../reporters'
74import type {
85 ApiConfig,
96 ResolvedConfig,
107 UserConfig,
118 VitestRunMode,
129} from '../types/config'
1010+import type { BaseCoverageOptions, CoverageReporterWithOptions } from '../types/coverage'
1111+import type { BuiltinPool, ForksOptions, PoolOptions, ThreadsOptions } from '../types/pool-options'
1212+import { toArray } from '@vitest/utils'
1313+import { resolveModule } from 'local-pkg'
1414+import { normalize, relative, resolve } from 'pathe'
1515+import c from 'tinyrainbow'
1316import {
1417 defaultBrowserPort,
1518 defaultInspectPort,
···1720 extraInlineDeps,
1821} from '../../constants'
1922import { benchmarkConfigDefaults, configDefaults } from '../../defaults'
2020-import type { BuiltinPool, ForksOptions, PoolOptions, ThreadsOptions } from '../types/pool-options'
2323+import { isCI, stdProvider } from '../../utils/env'
2124import { getWorkersCountByPercentage } from '../../utils/workers'
2225import { VitestCache } from '../cache'
2626+import { builtinPools } from '../pool'
2327import { BaseSequencer } from '../sequencers/BaseSequencer'
2428import { RandomSequencer } from '../sequencers/RandomSequencer'
2525-import type { BenchmarkBuiltinReporters } from '../reporters'
2626-import { builtinPools } from '../pool'
2727-import type { Logger } from '../logger'
2828-import type { BaseCoverageOptions, CoverageReporterWithOptions } from '../types/coverage'
29293030function resolvePath(path: string, root: string) {
3131 return normalize(
···11import type { Plugin as VitePlugin } from 'vite'
22-import { normalizeRequestId } from 'vite-node/utils'
33-42import type { Vitest } from '../core'
33+44+import { normalizeRequestId } from 'vite-node/utils'
5566export function CoverageTransform(ctx: Vitest): VitePlugin {
77 return {
+3-3
packages/vitest/src/node/plugins/cssEnabler.ts
···11-import { relative } from 'pathe'
21import type { Plugin as VitePlugin } from 'vite'
33-import { toArray } from '@vitest/utils'
44-import { generateCssFilenameHash } from '../../integrations/css/css-modules'
52import type { CSSModuleScopeStrategy, ResolvedConfig } from '../types/config'
33+import { toArray } from '@vitest/utils'
44+import { relative } from 'pathe'
55+import { generateCssFilenameHash } from '../../integrations/css/css-modules'
6677const cssLangs = '\\.(?:css|less|sass|scss|styl|stylus|pcss|postcss)(?:$|\\?)'
88const cssLangRE = new RegExp(cssLangs)
+8-8
packages/vitest/src/node/plugins/index.ts
···11import type { UserConfig as ViteConfig, Plugin as VitePlugin } from 'vite'
22-import { relative } from 'pathe'
22+import type { ResolvedConfig, UserConfig } from '../types/config'
33import {
44 deepMerge,
55 notNullish,
66 toArray,
77} from '@vitest/utils'
88+import { relative } from 'pathe'
99+import { defaultPort } from '../../constants'
810import { configDefaults, coverageConfigDefaults } from '../../defaults'
99-import type { ResolvedConfig, UserConfig } from '../types/config'
1111+import { generateScopedClassName } from '../../integrations/css/css-modules'
1012import { resolveApiServerConfig } from '../config/resolveConfig'
1113import { Vitest } from '../core'
1212-import { generateScopedClassName } from '../../integrations/css/css-modules'
1313-import { defaultPort } from '../../constants'
1414import { createViteLogger } from '../viteLogger'
1515-import { SsrReplacerPlugin } from './ssrReplacer'
1616-import { CSSEnablerPlugin } from './cssEnabler'
1715import { CoverageTransform } from './coverageTransform'
1616+import { CSSEnablerPlugin } from './cssEnabler'
1817import { MocksPlugins } from './mocks'
1818+import { NormalizeURLPlugin } from './normalizeURL'
1919+import { VitestOptimizer } from './optimizer'
2020+import { SsrReplacerPlugin } from './ssrReplacer'
1921import {
2022 deleteDefineConfig,
2123 hijackVitePluginInject,
2224 resolveFsAllow,
2325} from './utils'
2424-import { VitestOptimizer } from './optimizer'
2525-import { NormalizeURLPlugin } from './normalizeURL'
2626import { VitestCoreResolver } from './vitestResolver'
27272828export async function VitestPlugin(
+1-1
packages/vitest/src/node/plugins/normalizeURL.ts
···11-import { stripLiteral } from 'strip-literal'
21import type { Plugin } from 'vite'
22+import { stripLiteral } from 'strip-literal'
3344const metaUrlLength = 'import.meta.url'.length
55const locationString = 'self.location'.padEnd(metaUrlLength, ' ')
+1-1
packages/vitest/src/node/plugins/ssrReplacer.ts
···11-import MagicString from 'magic-string'
21import type { Plugin } from 'vite'
22+import MagicString from 'magic-string'
33import { stripLiteral } from 'strip-literal'
44import { cleanUrl } from 'vite-node/utils'
55
+3-3
packages/vitest/src/node/plugins/utils.ts
···11-import { searchForWorkspaceRoot, version as viteVersion } from 'vite'
21import type {
32 DepOptimizationOptions,
43 ResolvedConfig,
54 UserConfig as ViteConfig,
65} from 'vite'
77-import { dirname } from 'pathe'
86import type { DepsOptimizationOptions, InlineConfig } from '../types/config'
99-import { VitestCache } from '../cache'
77+import { dirname } from 'pathe'
88+import { searchForWorkspaceRoot, version as viteVersion } from 'vite'
109import { rootDir } from '../../paths'
1010+import { VitestCache } from '../cache'
11111212export function resolveOptimizerConfig(
1313 _testOptions: DepsOptimizationOptions | undefined,
···11import type { Plugin } from 'vite'
22-import { join, resolve } from 'pathe'
32import type { Vitest } from '../core'
33+import { join, resolve } from 'pathe'
44import { distDir } from '../../paths'
5566export function VitestProjectResolver(ctx: Vitest): Plugin {
+7-7
packages/vitest/src/node/plugins/workspace.ts
···11-import { existsSync, readFileSync } from 'node:fs'
22-import { basename, dirname, relative, resolve } from 'pathe'
31import type { UserConfig as ViteConfig, Plugin as VitePlugin } from 'vite'
22+import type { ResolvedConfig, UserWorkspaceConfig } from '../types/config'
33+import type { WorkspaceProject } from '../workspace'
44+import { existsSync, readFileSync } from 'node:fs'
45import { deepMerge } from '@vitest/utils'
66+import { basename, dirname, relative, resolve } from 'pathe'
57import { configDefaults } from '../../defaults'
68import { generateScopedClassName } from '../../integrations/css/css-modules'
77-import type { WorkspaceProject } from '../workspace'
88-import type { ResolvedConfig, UserWorkspaceConfig } from '../types/config'
99import { createViteLogger } from '../viteLogger'
1010import { CoverageTransform } from './coverageTransform'
1111import { CSSEnablerPlugin } from './cssEnabler'
1212-import { SsrReplacerPlugin } from './ssrReplacer'
1312import { MocksPlugins } from './mocks'
1313+import { NormalizeURLPlugin } from './normalizeURL'
1414+import { VitestOptimizer } from './optimizer'
1515+import { SsrReplacerPlugin } from './ssrReplacer'
1416import {
1517 deleteDefineConfig,
1618 hijackVitePluginInject,
1719 resolveFsAllow,
1820} from './utils'
1921import { VitestProjectResolver } from './vitestResolver'
2020-import { VitestOptimizer } from './optimizer'
2121-import { NormalizeURLPlugin } from './normalizeURL'
22222323interface WorkspaceOptions extends UserWorkspaceConfig {
2424 root?: string
+12-12
packages/vitest/src/node/pools/forks.ts
···11-import v8 from 'node:v8'
22-import * as nodeos from 'node:os'
33-import EventEmitter from 'node:events'
44-import { Tinypool } from 'tinypool'
51import type { TinypoolChannel, Options as TinypoolOptions } from 'tinypool'
22+import type { RunnerRPC, RuntimeRPC } from '../../types/rpc'
33+import type { ContextRPC, ContextTestEnvironment } from '../../types/worker'
44+import type { Vitest } from '../core'
55+import type { PoolProcessOptions, ProcessPool, RunWithFiles } from '../pool'
66+import type { SerializedConfig } from '../types/config'
77+import type { WorkspaceProject } from '../workspace'
88+import EventEmitter from 'node:events'
99+import * as nodeos from 'node:os'
1010+import v8 from 'node:v8'
611import { createBirpc } from 'birpc'
712import { resolve } from 'pathe'
88-import type { PoolProcessOptions, ProcessPool, RunWithFiles } from '../pool'
99-import type { WorkspaceProject } from '../workspace'
1010-import { envsOrder, groupFilesByEnv } from '../../utils/test-helpers'
1111-import { wrapSerializableConfig } from '../../utils/config-helpers'
1313+import { Tinypool } from 'tinypool'
1214import { groupBy } from '../../utils/base'
1313-import type { SerializedConfig } from '../types/config'
1414-import type { RunnerRPC, RuntimeRPC } from '../../types/rpc'
1515-import type { Vitest } from '../core'
1616-import type { ContextRPC, ContextTestEnvironment } from '../../types/worker'
1515+import { wrapSerializableConfig } from '../../utils/config-helpers'
1616+import { envsOrder, groupFilesByEnv } from '../../utils/test-helpers'
1717import { createMethodsRPC } from './rpc'
18181919function createChildProcessChannel(project: WorkspaceProject) {
+3-3
packages/vitest/src/node/pools/rpc.ts
···11-import { mkdir, writeFile } from 'node:fs/promises'
21import type { RawSourceMap } from 'vite-node'
33-import { join } from 'pathe'
44-import type { WorkspaceProject } from '../workspace'
52import type { RuntimeRPC } from '../../types/rpc'
33+import type { WorkspaceProject } from '../workspace'
44+import { mkdir, writeFile } from 'node:fs/promises'
55+import { join } from 'pathe'
66import { hash } from '../hash'
7788const created = new Set()
+10-10
packages/vitest/src/node/pools/threads.ts
···11-import { MessageChannel } from 'node:worker_threads'
22-import * as nodeos from 'node:os'
33-import { createBirpc } from 'birpc'
41import type { Options as TinypoolOptions } from 'tinypool'
55-import Tinypool from 'tinypool'
66-import { resolve } from 'pathe'
77-import type { PoolProcessOptions, ProcessPool, RunWithFiles } from '../pool'
88-import { envsOrder, groupFilesByEnv } from '../../utils/test-helpers'
99-import { groupBy } from '../../utils/base'
1010-import type { WorkspaceProject } from '../workspace'
1111-import type { SerializedConfig } from '../types/config'
122import type { RunnerRPC, RuntimeRPC } from '../../types/rpc'
133import type { ContextTestEnvironment } from '../../types/worker'
144import type { Vitest } from '../core'
55+import type { PoolProcessOptions, ProcessPool, RunWithFiles } from '../pool'
66+import type { SerializedConfig } from '../types/config'
157import type { WorkerContext } from '../types/worker'
88+import type { WorkspaceProject } from '../workspace'
99+import * as nodeos from 'node:os'
1010+import { MessageChannel } from 'node:worker_threads'
1111+import { createBirpc } from 'birpc'
1212+import { resolve } from 'pathe'
1313+import Tinypool from 'tinypool'
1414+import { groupBy } from '../../utils/base'
1515+import { envsOrder, groupFilesByEnv } from '../../utils/test-helpers'
1616import { createMethodsRPC } from './rpc'
17171818function createWorkerChannel(project: WorkspaceProject) {
+4-4
packages/vitest/src/node/pools/typecheck.ts
···11import type { DeferPromise } from '@vitest/utils'
22-import { createDefer } from '@vitest/utils'
33-import { hasFailed } from '@vitest/runner/utils'
42import type { TypecheckResults } from '../../typecheck/typechecker'
55-import { Typechecker } from '../../typecheck/typechecker'
66-import { groupBy } from '../../utils/base'
73import type { Vitest } from '../core'
84import type { ProcessPool, WorkspaceSpec } from '../pool'
95import type { WorkspaceProject } from '../workspace'
66+import { hasFailed } from '@vitest/runner/utils'
77+import { createDefer } from '@vitest/utils'
88+import { Typechecker } from '../../typecheck/typechecker'
99+import { groupBy } from '../../utils/base'
10101111export function createTypecheckPool(ctx: Vitest): ProcessPool {
1212 const promisesMap = new WeakMap<WorkspaceProject, DeferPromise<void>>()
+10-10
packages/vitest/src/node/pools/vmForks.ts
···11+import type { TinypoolChannel, Options as TinypoolOptions } from 'tinypool'
22+import type { RunnerRPC, RuntimeRPC } from '../../types/rpc'
33+import type { ContextRPC, ContextTestEnvironment } from '../../types/worker'
44+import type { Vitest } from '../core'
55+import type { PoolProcessOptions, ProcessPool, RunWithFiles } from '../pool'
66+import type { ResolvedConfig, SerializedConfig } from '../types/config'
77+import type { WorkspaceProject } from '../workspace'
88+import EventEmitter from 'node:events'
19import * as nodeos from 'node:os'
210import v8 from 'node:v8'
33-import EventEmitter from 'node:events'
411import { createBirpc } from 'birpc'
512import { resolve } from 'pathe'
66-import type { TinypoolChannel, Options as TinypoolOptions } from 'tinypool'
713import Tinypool from 'tinypool'
814import { rootDir } from '../../paths'
99-import type { PoolProcessOptions, ProcessPool, RunWithFiles } from '../pool'
1010-import { groupFilesByEnv } from '../../utils/test-helpers'
1111-import type { WorkspaceProject } from '../workspace'
1212-import { getWorkerMemoryLimit, stringToBytes } from '../../utils/memory-limit'
1315import { wrapSerializableConfig } from '../../utils/config-helpers'
1414-import type { ResolvedConfig, SerializedConfig } from '../types/config'
1515-import type { RunnerRPC, RuntimeRPC } from '../../types/rpc'
1616-import type { Vitest } from '../core'
1717-import type { ContextRPC, ContextTestEnvironment } from '../../types/worker'
1616+import { getWorkerMemoryLimit, stringToBytes } from '../../utils/memory-limit'
1717+import { groupFilesByEnv } from '../../utils/test-helpers'
1818import { createMethodsRPC } from './rpc'
19192020const suppressWarningsPath = resolve(rootDir, './suppress-warnings.cjs')
+11-11
packages/vitest/src/node/pools/vmThreads.ts
···11-import { MessageChannel } from 'node:worker_threads'
22-import * as nodeos from 'node:os'
33-import { createBirpc } from 'birpc'
44-import { resolve } from 'pathe'
51import type { Options as TinypoolOptions } from 'tinypool'
66-import Tinypool from 'tinypool'
77-import { rootDir } from '../../paths'
88-import type { PoolProcessOptions, ProcessPool, RunWithFiles } from '../pool'
99-import { groupFilesByEnv } from '../../utils/test-helpers'
1010-import type { WorkspaceProject } from '../workspace'
1111-import { getWorkerMemoryLimit, stringToBytes } from '../../utils/memory-limit'
1212-import type { ResolvedConfig, SerializedConfig } from '../types/config'
132import type { RunnerRPC, RuntimeRPC } from '../../types/rpc'
143import type { ContextTestEnvironment } from '../../types/worker'
154import type { Vitest } from '../core'
55+import type { PoolProcessOptions, ProcessPool, RunWithFiles } from '../pool'
66+import type { ResolvedConfig, SerializedConfig } from '../types/config'
167import type { WorkerContext } from '../types/worker'
88+import type { WorkspaceProject } from '../workspace'
99+import * as nodeos from 'node:os'
1010+import { MessageChannel } from 'node:worker_threads'
1111+import { createBirpc } from 'birpc'
1212+import { resolve } from 'pathe'
1313+import Tinypool from 'tinypool'
1414+import { rootDir } from '../../paths'
1515+import { getWorkerMemoryLimit, stringToBytes } from '../../utils/memory-limit'
1616+import { groupFilesByEnv } from '../../utils/test-helpers'
1717import { createMethodsRPC } from './rpc'
18181919const suppressWarningsPath = resolve(rootDir, './suppress-warnings.cjs')
+8-8
packages/vitest/src/node/reporters/base.ts
···11-import { performance } from 'node:perf_hooks'
22-import c from 'tinyrainbow'
33-import { parseStacktrace } from '@vitest/utils/source-map'
44-import { relative } from 'pathe'
51import type { File, Task, TaskResultPack } from '@vitest/runner'
66-import { toArray } from '@vitest/utils'
77-import { getFullName, getSuites, getTestName, getTests, hasFailed } from '@vitest/runner/utils'
88-import { isCI, isDeno, isNode } from '../../utils/env'
22+import type { ErrorWithDiff, UserConsoleLog } from '../../types/general'
93import type { Vitest } from '../core'
104import type { Reporter } from '../types/reporter'
1111-import type { ErrorWithDiff, UserConsoleLog } from '../../types/general'
55+import { performance } from 'node:perf_hooks'
66+import { getFullName, getSuites, getTestName, getTests, hasFailed } from '@vitest/runner/utils'
77+import { toArray } from '@vitest/utils'
88+import { parseStacktrace } from '@vitest/utils/source-map'
99+import { relative } from 'pathe'
1010+import c from 'tinyrainbow'
1111+import { isCI, isDeno, isNode } from '../../utils/env'
1212import { hasFailedSnapshot } from '../../utils/tasks'
1313import { F_CHECK, F_POINTER, F_RIGHT } from './renderers/figures'
1414import {
+5-5
packages/vitest/src/node/reporters/blob.ts
···11-import { mkdir, readFile, readdir, stat, writeFile } from 'node:fs/promises'
11+import type { File } from '@vitest/runner'
22+import type { Vitest } from '../core'
33+import type { Reporter } from '../types/reporter'
44+import type { WorkspaceProject } from '../workspace'
25import { existsSync } from 'node:fs'
66+import { mkdir, readdir, readFile, stat, writeFile } from 'node:fs/promises'
37import { parse, stringify } from 'flatted'
48import { dirname, resolve } from 'pathe'
55-import type { File } from '@vitest/runner'
69import { getOutputFile } from '../../utils/config-helpers'
77-import type { WorkspaceProject } from '../workspace'
88-import type { Reporter } from '../types/reporter'
99-import type { Vitest } from '../core'
10101111export interface BlobOptions {
1212 outputFile?: string
+2-2
packages/vitest/src/node/reporters/default.ts
···11-import c from 'tinyrainbow'
21import type { UserConsoleLog } from '../../types/general'
33-import { BaseReporter } from './base'
42import type { ListRendererOptions } from './renderers/listRenderer'
33+import c from 'tinyrainbow'
44+import { BaseReporter } from './base'
55import { createListRenderer } from './renderers/listRenderer'
6677export class DefaultReporter extends BaseReporter {
···11+import type { File } from '@vitest/runner'
22+import type { Vitest } from '../core'
33+import type { Reporter } from '../types/reporter'
44+import type { WorkspaceProject } from '../workspace'
15import { stripVTControlCharacters } from 'node:util'
26import { getFullName, getTasks } from '@vitest/runner/utils'
33-import type { File } from '@vitest/runner'
47import { capturePrintError } from '../error'
55-import type { WorkspaceProject } from '../workspace'
66-import type { Reporter } from '../types/reporter'
77-import type { Vitest } from '../core'
8899export class GithubActionsReporter implements Reporter {
1010 ctx: Vitest = undefined!
···11-import { createRequire } from 'node:module'
21import type { Reporter } from '../types/reporter'
22+import { createRequire } from 'node:module'
3344export class HangingProcessReporter implements Reporter {
55 whyRunning: (() => void) | undefined
+35-35
packages/vitest/src/node/reporters/index.ts
···11import type { Reporter } from '../types/reporter'
22+import type { BaseOptions, BaseReporter } from './base'
33+import type { BlobOptions } from './blob'
44+import type { HTMLOptions } from './html'
55+import type { ModuleDiagnostic as _FileDiagnostic } from './reported-tasks'
26import { BasicReporter } from './basic'
77+import { BlobReporter } from './blob'
38import { DefaultReporter } from './default'
49import { DotReporter } from './dot'
55-import { type JsonOptions, JsonReporter } from './json'
66-import { VerboseReporter } from './verbose'
77-import { TapReporter } from './tap'
88-import { type JUnitOptions, JUnitReporter } from './junit'
99-import { TapFlatReporter } from './tap-flat'
1010-import { HangingProcessReporter } from './hanging-process'
1110import { GithubActionsReporter } from './github-actions'
1212-import type { BaseOptions, BaseReporter } from './base'
1313-import type { HTMLOptions } from './html'
1414-import type { BlobOptions } from './blob'
1515-import { BlobReporter } from './blob'
1111+import { HangingProcessReporter } from './hanging-process'
1212+import { type JsonOptions, JsonReporter } from './json'
1313+import { type JUnitOptions, JUnitReporter } from './junit'
1614import { TestModule as _TestFile } from './reported-tasks'
1717-import type { ModuleDiagnostic as _FileDiagnostic } from './reported-tasks'
1515+import { TapReporter } from './tap'
1616+import { TapFlatReporter } from './tap-flat'
1717+import { VerboseReporter } from './verbose'
18181919export {
2020- DefaultReporter,
2120 BasicReporter,
2121+ DefaultReporter,
2222 DotReporter,
2323+ GithubActionsReporter,
2424+ HangingProcessReporter,
2325 JsonReporter,
2424- VerboseReporter,
2525- TapReporter,
2626 JUnitReporter,
2727 TapFlatReporter,
2828- HangingProcessReporter,
2929- GithubActionsReporter,
2828+ TapReporter,
2929+ VerboseReporter,
3030}
3131export type { BaseReporter, Reporter }
32323333-export { TestCase, TestModule, TestSuite } from './reported-tasks'
3333+export type { TestProject } from '../reported-workspace-project'
3434/**
3535 * @deprecated Use `TestModule` instead
3636 */
3737export const TestFile = _TestFile
3838-export type { TestProject } from '../reported-workspace-project'
3939-export type {
4040- TestCollection,
4141-4242- TaskOptions,
4343- TestDiagnostic,
4444-4545- TestResult,
4646- TestResultFailed,
4747- TestResultPassed,
4848- TestResultSkipped,
4949-} from './reported-tasks'
5050-/**
5151- * @deprecated Use `ModuleDiagnostic` instead
5252- */
5353-export type FileDiagnostic = _FileDiagnostic
5454-3838+export * from './benchmark'
5539export type {
5640 JsonAssertionResult,
5741 JsonTestResult,
5842 JsonTestResults,
5943} from './json'
4444+/**
4545+ * @deprecated Use `ModuleDiagnostic` instead
4646+ */
4747+export type FileDiagnostic = _FileDiagnostic
4848+4949+export { TestCase, TestModule, TestSuite } from './reported-tasks'
60506151export const ReportersMap = {
6252 'default': DefaultReporter,
···8878 'html': HTMLOptions
8979}
90809191-export * from './benchmark'
8181+export type {
8282+ TaskOptions,
8383+8484+ TestCollection,
8585+ TestDiagnostic,
8686+8787+ TestResult,
8888+ TestResultFailed,
8989+ TestResultPassed,
9090+ TestResultSkipped,
9191+} from './reported-tasks'
+5-5
packages/vitest/src/node/reporters/json.ts
···11-import { existsSync, promises as fs } from 'node:fs'
22-import { dirname, resolve } from 'pathe'
31import type { File, Suite, TaskMeta, TaskState } from '@vitest/runner'
42import type { SnapshotSummary } from '@vitest/snapshot'
55-import { getSuites, getTests } from '@vitest/runner/utils'
66-import { getOutputFile } from '../../utils/config-helpers'
77-import type { Reporter } from '../types/reporter'
83import type { Vitest } from '../core'
44+import type { Reporter } from '../types/reporter'
55+import { existsSync, promises as fs } from 'node:fs'
66+import { getSuites, getTests } from '@vitest/runner/utils'
77+import { dirname, resolve } from 'pathe'
88+import { getOutputFile } from '../../utils/config-helpers'
991010// for compatibility reasons, the reporter produces a JSON similar to the one produced by the Jest JSON reporter
1111// the following types are extracted from the Jest repository (and simplified)
+6-6
packages/vitest/src/node/reporters/junit.ts
···11-import { existsSync, promises as fs } from 'node:fs'
22-import { hostname } from 'node:os'
33-import { stripVTControlCharacters } from 'node:util'
44-import { dirname, relative, resolve } from 'pathe'
55-61import type { Task } from '@vitest/runner'
77-import { getSuites } from '@vitest/runner/utils'
82import type { Vitest } from '../core'
93import type { Reporter } from '../types/reporter'
44+import { existsSync, promises as fs } from 'node:fs'
55+66+import { hostname } from 'node:os'
77+import { stripVTControlCharacters } from 'node:util'
88+import { getSuites } from '@vitest/runner/utils'
99+import { dirname, relative, resolve } from 'pathe'
1010import { getOutputFile } from '../../utils/config-helpers'
1111import { capturePrintError } from '../error'
1212import { IndentedLogger } from './renderers/indented-logger'
+3-3
packages/vitest/src/node/reporters/utils.ts
···11import type { ViteNodeRunner } from 'vite-node/client'
22-import type { Reporter } from '../types/reporter'
33-import type { ResolvedConfig } from '../types/config'
42import type { Vitest } from '../core'
33+import type { ResolvedConfig } from '../types/config'
44+import type { Reporter } from '../types/reporter'
55import type { BenchmarkBuiltinReporters, BuiltinReporters } from './index'
66import { BenchmarkReportsMap, ReportersMap } from './index'
77···9797 return Promise.all(promisedReporters)
9898}
9999100100-export { createReporters, createBenchmarkReporters }
100100+export { createBenchmarkReporters, createReporters }
+2-2
packages/vitest/src/node/reporters/verbose.ts
···11-import c from 'tinyrainbow'
21import type { TaskResultPack } from '@vitest/runner'
32import { getFullName } from '@vitest/runner/utils'
44-import { F_RIGHT } from './renderers/figures'
33+import c from 'tinyrainbow'
54import { DefaultReporter } from './default'
55+import { F_RIGHT } from './renderers/figures'
66import { formatProjectName, getStateSymbol } from './renderers/utils'
7788export class VerboseReporter extends DefaultReporter {
···11-import { shuffle } from '@vitest/utils'
21import type { WorkspaceSpec } from '../pool'
22+import { shuffle } from '@vitest/utils'
33import { BaseSequencer } from './BaseSequencer'
4455export class RandomSequencer extends BaseSequencer {
+2-2
packages/vitest/src/node/types/browser.ts
···11-import type { Awaitable, ErrorWithDiff, ParsedStack } from '@vitest/utils'
22-import type { ViteDevServer } from 'vite'
31import type { CancelReason } from '@vitest/runner'
22+import type { Awaitable, ErrorWithDiff, ParsedStack } from '@vitest/utils'
43import type { StackTraceParserOptions } from '@vitest/utils/source-map'
44+import type { ViteDevServer } from 'vite'
55import type { WorkspaceProject } from '../workspace'
66import type { ApiConfig } from './config'
77
+14-14
packages/vitest/src/node/types/config.ts
···11-import type { AliasOptions, ConfigEnv, DepOptimizationConfig, ServerOptions, UserConfig as ViteUserConfig } from 'vite'
22-import type { PrettyFormatOptions } from '@vitest/pretty-format'
31import type { FakeTimerInstallOpts } from '@sinonjs/fake-timers'
22+import type { PrettyFormatOptions } from '@vitest/pretty-format'
43import type { SequenceHooks, SequenceSetupFiles } from '@vitest/runner'
55-import type { ViteNodeServerOptions } from 'vite-node'
64import type { SnapshotStateOptions } from '@vitest/snapshot'
55+import type { AliasOptions, ConfigEnv, DepOptimizationConfig, ServerOptions, UserConfig as ViteUserConfig } from 'vite'
66+import type { ViteNodeServerOptions } from 'vite-node'
77+import type { ChaiConfig } from '../../integrations/chai/config'
88+import type { EnvironmentOptions } from '../../types/environment'
99+import type { Arrayable, ErrorWithDiff, ParsedStack, ProvidedContext } from '../../types/general'
1010+import type { HappyDOMOptions } from '../../types/happy-dom-options'
1111+import type { JSDOMOptions } from '../../types/jsdom-options'
712import type {
813 BuiltinReporterOptions,
914 BuiltinReporters,
1015} from '../reporters'
1116import type { TestSequencerConstructor } from '../sequencers/types'
1212-import type { ChaiConfig } from '../../integrations/chai/config'
1313-import type { Arrayable, ErrorWithDiff, ParsedStack, ProvidedContext } from '../../types/general'
1414-import type { JSDOMOptions } from '../../types/jsdom-options'
1515-import type { HappyDOMOptions } from '../../types/happy-dom-options'
1616-import type { EnvironmentOptions } from '../../types/environment'
1717+import type { BenchmarkUserOptions } from './benchmark'
1818+import type { BrowserConfigOptions, ResolvedBrowserOptions } from './browser'
1719import type { CoverageOptions, ResolvedCoverageOptions } from './coverage'
1820import type { Pool, PoolOptions, ResolvedPoolOptions } from './pool-options'
1919-import type { BrowserConfigOptions, ResolvedBrowserOptions } from './browser'
2021import type { Reporter } from './reporter'
2121-import type { BenchmarkUserOptions } from './benchmark'
22222323export type { CoverageOptions, ResolvedCoverageOptions }
2424export type { BenchmarkUserOptions }
2525-export type { CoverageV8Options, CoverageIstanbulOptions } from './coverage'
2626-export type { BrowserScript, BrowserConfigOptions } from './browser'
2525+export type { RuntimeConfig, SerializedConfig } from '../../runtime/config'
2626+export type { BrowserConfigOptions, BrowserScript } from './browser'
2727+export type { CoverageIstanbulOptions, CoverageV8Options } from './coverage'
2728export type { SequenceHooks, SequenceSetupFiles } from '@vitest/runner'
2828-export type { SerializedConfig, RuntimeConfig } from '../../runtime/config'
29293030export type BuiltinEnvironment =
3131 | 'node'
···4444 'port' | 'strictPort' | 'host' | 'middlewareMode'
4545>
46464747-export type { JSDOMOptions, HappyDOMOptions, EnvironmentOptions }
4747+export type { EnvironmentOptions, HappyDOMOptions, JSDOMOptions }
48484949export type VitestRunMode = 'test' | 'benchmark'
5050
+1-1
packages/vitest/src/node/types/coverage.ts
···11-import type { TransformResult as ViteTransformResult } from 'vite'
21import type { ReportOptions } from 'istanbul-reports'
22+import type { TransformResult as ViteTransformResult } from 'vite'
33import type { AfterSuiteRunMeta, Arrayable } from '../../types/general'
44import type { Vitest } from '../core'
55
+1-1
packages/vitest/src/node/types/reporter.ts
···11import type { File, TaskResultPack } from '@vitest/runner'
22-import type { Vitest } from '../core'
32import type { SerializedTestSpecification } from '../../runtime/types/utils'
43import type { Awaitable, UserConsoleLog } from '../../types/general'
44+import type { Vitest } from '../core'
5566export interface Reporter {
77 onInit?: (ctx: Vitest) => void
···11-import { existsSync, promises as fs } from 'node:fs'
22-import { isMainThread } from 'node:worker_threads'
33-import { dirname, relative, resolve } from 'pathe'
44-import fg from 'fast-glob'
55-import { mergeConfig } from 'vite'
61import type { Vitest } from '../core'
72import type { UserConfig, UserWorkspaceConfig, WorkspaceProjectConfiguration } from '../types/config'
83import type { WorkspaceProject } from '../workspace'
99-import { initializeProject } from '../workspace'
44+import { existsSync, promises as fs } from 'node:fs'
55+import { isMainThread } from 'node:worker_threads'
66+import fg from 'fast-glob'
77+import { dirname, relative, resolve } from 'pathe'
88+import { mergeConfig } from 'vite'
109import { configFiles as defaultConfigFiles } from '../../constants'
1010+import { initializeProject } from '../workspace'
1111import { isDynamicPattern } from './fast-glob-pattern'
12121313export async function resolveWorkspace(
+7-7
packages/vitest/src/runtime/runners/benchmark.ts
···44 VitestRunner,
55 VitestRunnerImportSource,
66} from '@vitest/runner'
77+import type { SerializedConfig } from '../config'
88+import type { VitestExecutor } from '../execute'
99+import type {
1010+ Benchmark,
1111+ BenchmarkResult,
1212+ BenchTask,
1313+} from '../types/benchmark'
714import { updateTask as updateRunnerTask } from '@vitest/runner'
815import { createDefer, getSafeTimers } from '@vitest/utils'
916import { getBenchFn, getBenchOptions } from '../benchmark'
1017import { getWorkerState } from '../utils'
1111-import type {
1212- BenchTask,
1313- Benchmark,
1414- BenchmarkResult,
1515-} from '../types/benchmark'
1616-import type { SerializedConfig } from '../config'
1717-import type { VitestExecutor } from '../execute'
18181919function createBenchmarkResult(name: string): BenchmarkResult {
2020 return {
+7-7
packages/vitest/src/runtime/runners/index.ts
···11import type { VitestRunner, VitestRunnerConstructor } from '@vitest/runner'
22-import { resolve } from 'pathe'
33-import type { VitestExecutor } from '../execute'
44-import { distDir } from '../../paths'
55-import { getWorkerState } from '../utils'
66-import { rpc } from '../rpc'
77-import { takeCoverageInsideWorker } from '../../integrations/coverage'
88-import { loadDiffConfig, loadSnapshotSerializers } from '../setup-common'
92import type { SerializedConfig } from '../config'
33+import type { VitestExecutor } from '../execute'
44+import { resolve } from 'pathe'
55+import { takeCoverageInsideWorker } from '../../integrations/coverage'
66+import { distDir } from '../../paths'
77+import { rpc } from '../rpc'
88+import { loadDiffConfig, loadSnapshotSerializers } from '../setup-common'
99+import { getWorkerState } from '../utils'
10101111const runnersFile = resolve(distDir, 'runners.js')
1212
+6-6
packages/vitest/src/runtime/runners/test.ts
···11+import type { ExpectStatic } from '@vitest/expect'
12import type {
23 CancelReason,
34 Custom,
···1011 VitestRunner,
1112 VitestRunnerImportSource,
1213} from '@vitest/runner'
1313-import type { ExpectStatic } from '@vitest/expect'
1414-import { GLOBAL_EXPECT, getState, setState } from '@vitest/expect'
1515-import { getNames, getTestName, getTests } from '@vitest/runner/utils'
1616-import { getSnapshotClient } from '../../integrations/snapshot/chai'
1717-import { vi } from '../../integrations/vi'
1818-import { createExpect } from '../../integrations/chai/index'
1914import type { SerializedConfig } from '../config'
2015import type { VitestExecutor } from '../execute'
1616+import { getState, GLOBAL_EXPECT, setState } from '@vitest/expect'
1717+import { getNames, getTestName, getTests } from '@vitest/runner/utils'
1818+import { createExpect } from '../../integrations/chai/index'
1919+import { getSnapshotClient } from '../../integrations/snapshot/chai'
2020+import { vi } from '../../integrations/vi'
2121import { rpc } from '../rpc'
2222import { getWorkerState } from '../utils'
2323
···11-import vm from 'node:vm'
11+import type { FileMap } from './file-map'
22+import type { ImportModuleDynamically, VMModule } from './types'
23import { Module as _Module, createRequire } from 'node:module'
44+import vm from 'node:vm'
35import { basename, dirname, extname } from 'pathe'
46import { isNodeBuiltin } from 'vite-node/utils'
55-import type { ImportModuleDynamically, VMModule } from './types'
66-import type { FileMap } from './file-map'
7788interface CommonjsExecutorOptions {
99 fileMap: FileMap
+2-2
packages/vitest/src/runtime/vm/esm-executor.ts
···11import type vm from 'node:vm'
22-import { fileURLToPath } from 'node:url'
33-import { dirname } from 'node:path'
42import type { ExternalModulesExecutor } from '../external-executor'
53import type { VMModule } from './types'
44+import { dirname } from 'node:path'
55+import { fileURLToPath } from 'node:url'
66import { SourceTextModule, SyntheticModule } from './utils'
7788interface EsmExecutorOptions {
+1-1
packages/vitest/src/runtime/vm/utils.ts
···11+import type { VMSourceTextModule, VMSyntheticModule } from './types'
12import vm from 'node:vm'
23import { isPrimitive } from 'vite-node/utils'
33-import type { VMSourceTextModule, VMSyntheticModule } from './types'
4455export function interopCommonJsModule(
66 interopDefault: boolean | undefined,
+3-3
packages/vitest/src/runtime/vm/vite-executor.ts
···11import type vm from 'node:vm'
22+import type { RuntimeRPC } from '../../types/rpc'
33+import type { WorkerGlobalState } from '../../types/worker'
44+import type { EsmExecutor } from './esm-executor'
25import { pathToFileURL } from 'node:url'
36import { normalize } from 'pathe'
47import { CSS_LANGS_RE, KNOWN_ASSET_RE } from 'vite-node/constants'
58import { toArray } from 'vite-node/utils'
66-import type { RuntimeRPC } from '../../types/rpc'
77-import type { WorkerGlobalState } from '../../types/worker'
88-import type { EsmExecutor } from './esm-executor'
99import { SyntheticModule } from './utils'
10101111interface ViteExecutorOptions {
+2-2
packages/vitest/src/runtime/workers/base.ts
···11-import { ModuleCacheMap } from 'vite-node/client'
21import type { WorkerGlobalState } from '../../types/worker'
33-import { provideWorkerState } from '../utils'
42import type { ContextExecutorOptions, VitestExecutor } from '../execute'
33+import { ModuleCacheMap } from 'vite-node/client'
54import { getDefaultRequestStubs, startVitestExecutor } from '../execute'
55+import { provideWorkerState } from '../utils'
6677let _viteNode: VitestExecutor
88
+3-3
packages/vitest/src/runtime/workers/forks.ts
···11-import v8 from 'node:v8'
21import type { WorkerGlobalState } from '../../types/worker'
33-import { createForksRpcOptions, unwrapSerializableConfig } from './utils'
44-import { runBaseTests } from './base'
52import type { VitestWorker } from './types'
33+import v8 from 'node:v8'
44+import { runBaseTests } from './base'
55+import { createForksRpcOptions, unwrapSerializableConfig } from './utils'
6677class ForksBaseWorker implements VitestWorker {
88 getRpcOptions() {
+1-1
packages/vitest/src/runtime/workers/threads.ts
···11import type { WorkerContext } from '../../node/types/worker'
22import type { ContextRPC, WorkerGlobalState } from '../../types/worker'
33-import { runBaseTests } from './base'
43import type { VitestWorker } from './types'
44+import { runBaseTests } from './base'
55import { createThreadsRpcOptions } from './utils'
6677class ThreadsBaseWorker implements VitestWorker {
+1-1
packages/vitest/src/runtime/workers/types.ts
···11-import type { BirpcOptions } from 'birpc'
21import type { Awaitable } from '@vitest/utils'
22+import type { BirpcOptions } from 'birpc'
33import type { RuntimeRPC } from '../../types/rpc'
44import type { ContextRPC, WorkerGlobalState } from '../../types/worker'
55
+1-1
packages/vitest/src/runtime/workers/utils.ts
···11import type { TinypoolWorkerMessage } from 'tinypool'
22-import { parseRegexp } from '@vitest/utils'
32import type { ResolvedConfig, SerializedConfig } from '../../node/types/config'
43import type { WorkerContext } from '../../node/types/worker'
54import type { WorkerRpcOptions } from './types'
55+import { parseRegexp } from '@vitest/utils'
6677const REGEXP_WRAP_PREFIX = '$$vitest:'
88
+5-5
packages/vitest/src/runtime/workers/vm.ts
···11import type { Context } from 'node:vm'
22-import { isContext } from 'node:vm'
33-import { pathToFileURL } from 'node:url'
44-import { resolve } from 'pathe'
52import type { WorkerGlobalState } from '../../types/worker'
33+import { pathToFileURL } from 'node:url'
44+import { isContext } from 'node:vm'
55+import { resolve } from 'pathe'
66+import { distDir } from '../../paths'
67import { createCustomConsole } from '../console'
78import { getDefaultRequestStubs, startVitestExecutor } from '../execute'
88-import { distDir } from '../../paths'
99import { ExternalModulesExecutor } from '../external-executor'
1010-import { FileMap } from '../vm/file-map'
1110import { provideWorkerState } from '../utils'
1111+import { FileMap } from '../vm/file-map'
12121313const entryFile = pathToFileURL(resolve(distDir, 'workers/runVmTests.js')).href
1414
+2-2
packages/vitest/src/runtime/workers/vmForks.ts
···11-import v8 from 'node:v8'
21import type { WorkerGlobalState } from '../../types/worker'
33-import { createForksRpcOptions, unwrapSerializableConfig } from './utils'
42import type { VitestWorker } from './types'
33+import v8 from 'node:v8'
44+import { createForksRpcOptions, unwrapSerializableConfig } from './utils'
55import { runVmTests } from './vm'
6677class ForksVmWorker implements VitestWorker {
···11+import type { BrowserRPC } from '@vitest/browser/client'
12import type {
23 LocatorByRoleOptions,
34 LocatorOptions,
···78 UserEventFillOptions,
89 UserEventHoverOptions,
910} from '@vitest/browser/context'
1111+import type { WorkerGlobalState } from 'vitest'
1212+import type { BrowserRunnerState } from '../../utils'
1013import { page, server } from '@vitest/browser/context'
1111-import type { BrowserRPC } from '@vitest/browser/client'
1214import {
1313- Ivya,
1414- type ParsedSelector,
1515 getByAltTextSelector,
1616 getByLabelSelector,
1717 getByPlaceholderSelector,
···1919 getByTestIdSelector,
2020 getByTextSelector,
2121 getByTitleSelector,
2222+ Ivya,
2323+ type ParsedSelector,
2224} from 'ivya'
2323-import type { WorkerGlobalState } from 'vitest'
2424-import type { BrowserRunnerState } from '../../utils'
2525import { getBrowserState, getWorkerState } from '../../utils'
2626import { getElementError } from '../public-utils'
2727
···11import type { SnapshotEnvironment } from '@vitest/snapshot/environment'
22-import type { VitestExecutor } from '../../../runtime/execute'
32import type { SerializedConfig } from '../../../runtime/config'
33+import type { VitestExecutor } from '../../../runtime/execute'
4455export async function resolveSnapshotEnvironment(
66 config: SerializedConfig,
···11-import c from 'tinyrainbow'
21import type { Task } from '@vitest/runner'
33-import { getTests } from '@vitest/runner/utils'
42import type { Logger } from '../../logger'
33+import { getTests } from '@vitest/runner/utils'
44+import c from 'tinyrainbow'
5566export interface DotRendererOptions {
77 logger: Logger
···11-import { stripVTControlCharacters } from 'node:util'
22-import c from 'tinyrainbow'
33-import cliTruncate from 'cli-truncate'
41import type { SuiteHooks, Task } from '@vitest/runner'
55-import { getTests } from '@vitest/runner/utils'
66-import { notNullish } from '@vitest/utils'
22+import type { Benchmark, BenchmarkResult } from '../../../runtime/types/benchmark'
73import type { Logger } from '../../logger'
84import type { VitestRunMode } from '../../types/config'
99-import type { Benchmark, BenchmarkResult } from '../../../runtime/types/benchmark'
55+import { stripVTControlCharacters } from 'node:util'
66+import { getTests } from '@vitest/runner/utils'
77+import { notNullish } from '@vitest/utils'
88+import cliTruncate from 'cli-truncate'
99+import c from 'tinyrainbow'
1010import { F_RIGHT } from './figures'
1111import {
1212 formatProjectName,
···11-import { stripVTControlCharacters } from 'node:util'
22-import { basename, dirname, isAbsolute, relative } from 'pathe'
33-import c from 'tinyrainbow'
41import type { SuiteHooks, Task } from '@vitest/runner'
52import type { SnapshotSummary } from '@vitest/snapshot'
33+import { stripVTControlCharacters } from 'node:util'
64import { slash } from '@vitest/utils'
55+import { basename, dirname, isAbsolute, relative } from 'pathe'
66+import c from 'tinyrainbow'
77import {
88 F_CHECK,
99 F_CROSS,
···11-import fs from 'node:fs'
22-import c from 'tinyrainbow'
33-import * as pathe from 'pathe'
41import type { File, TaskResultPack } from '@vitest/runner'
55-import { getFullName, getTasks } from '@vitest/runner/utils'
22+import type { BenchmarkResult } from '../../../../runtime/types/benchmark'
63import type { UserConsoleLog } from '../../../../types/general'
44+import fs from 'node:fs'
55+import { getFullName, getTasks } from '@vitest/runner/utils'
66+import * as pathe from 'pathe'
77+import c from 'tinyrainbow'
78import { BaseReporter } from '../../base'
89import { getStateSymbol } from '../../renderers/utils'
99-import type { BenchmarkResult } from '../../../../runtime/types/benchmark'
1010import {
1111- type TableRendererOptions,
1211 createTableRenderer,
1312 renderTree,
1313+ type TableRendererOptions,
1414} from './tableRender'
15151616export class TableReporter extends BaseReporter {
···11-import { stripVTControlCharacters } from 'node:util'
22-import c from 'tinyrainbow'
33-import cliTruncate from 'cli-truncate'
41import type { Task } from '@vitest/runner'
55-import { notNullish } from '@vitest/utils'
66-import { getTests } from '@vitest/runner/utils'
77-import type { Logger } from '../../../logger'
88-import { getCols, getStateSymbol } from '../../renderers/utils'
99-import type { BenchmarkResult } from '../../../../runtime/types/benchmark'
1010-import { F_RIGHT } from '../../renderers/figures'
112import type { FlatBenchmarkReport } from '.'
33+import type { BenchmarkResult } from '../../../../runtime/types/benchmark'
44+import type { Logger } from '../../../logger'
55+import { stripVTControlCharacters } from 'node:util'
66+import { getTests } from '@vitest/runner/utils'
77+import { notNullish } from '@vitest/utils'
88+import cliTruncate from 'cli-truncate'
99+import c from 'tinyrainbow'
1010+import { F_RIGHT } from '../../renderers/figures'
1111+import { getCols, getStateSymbol } from '../../renderers/utils'
12121313export interface TableRendererOptions {
1414 renderSucceed?: boolean