diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts
index 04a72c0a600e..b2907ac6c0bb 100644
--- a/docs/.vitepress/config.ts
+++ b/docs/.vitepress/config.ts
@@ -70,7 +70,6 @@ export default ({ mode }: { mode: string }) => {
customIcon: {
'CLI': 'vscode-icons:file-type-shell',
'vitest.shims': 'vscode-icons:file-type-vitest',
- 'vitest.workspace': 'vscode-icons:file-type-vitest',
'vitest.config': 'vscode-icons:file-type-vitest',
'.spec.ts': 'vscode-icons:file-type-testts',
'.test.ts': 'vscode-icons:file-type-testts',
diff --git a/docs/config/index.md b/docs/config/index.md
index 3bd4e9627c3a..673125da3bde 100644
--- a/docs/config/index.md
+++ b/docs/config/index.md
@@ -2362,20 +2362,6 @@ Relevant only when using with `shouldAdvanceTime: true`. increment mocked time b
Tells fake timers to clear "native" (i.e. not fake) timers by delegating to their respective handlers. When disabled, it can lead to potentially unexpected behavior if timers existed prior to starting fake timers session.
-### workspace {#workspace}
-
-::: danger DEPRECATED
-This options is deprecated and will be removed in the next major. Please, use [`projects`](#projects) instead.
-:::
-
-- **Type:** `string | TestProjectConfiguration[]`
-- **CLI:** `--workspace=./file.js`
-- **Default:** `vitest.{workspace,projects}.{js,ts,json}` close to the config file or root
-
-Path to a [workspace](/guide/projects) config file relative to [root](#root).
-
-Since Vitest 3, you can also define the workspace array in the root config. If the `workspace` is defined in the config manually, Vitest will ignore the `vitest.workspace` file in the root.
-
### projects {#projects}
- **Type:** `TestProjectConfiguration[]`
diff --git a/docs/guide/cli-generated.md b/docs/guide/cli-generated.md
index 7d0d57790f4e..6e82e6af7427 100644
--- a/docs/guide/cli-generated.md
+++ b/docs/guide/cli-generated.md
@@ -272,13 +272,6 @@ High and low watermarks for functions in the format of `,`
Override Vite mode (default: `test` or `benchmark`)
-### workspace
-
-- **CLI:** `--workspace `
-- **Config:** [workspace](/config/#workspace)
-
-[deprecated] Path to a workspace configuration file
-
### isolate
- **CLI:** `--isolate`
diff --git a/docs/guide/migration.md b/docs/guide/migration.md
index 833ab65a714c..1be8cd3794e5 100644
--- a/docs/guide/migration.md
+++ b/docs/guide/migration.md
@@ -122,6 +122,7 @@ Vitest 4.0 removes some deprecated APIs, including:
- `poolMatchGlobs` config option. Use [`projects`](/guide/projects) instead.
- `environmentMatchGlobs` config option. Use [`projects`](/guide/projects) instead.
+- `workspace` config option. Use [`projects`](/guide/projects) instead.
## Migrating from Jest {#jest}
diff --git a/packages/vitest/src/constants.ts b/packages/vitest/src/constants.ts
index df7b9ebb27fa..dfa6c6883d22 100644
--- a/packages/vitest/src/constants.ts
+++ b/packages/vitest/src/constants.ts
@@ -14,20 +14,12 @@ export const extraInlineDeps: RegExp[] = [
export const CONFIG_NAMES: string[] = ['vitest.config', 'vite.config']
-const WORKSPACES_NAMES = ['vitest.workspace', 'vitest.projects']
-
export const CONFIG_EXTENSIONS: string[] = ['.ts', '.mts', '.cts', '.js', '.mjs', '.cjs']
export const configFiles: string[] = CONFIG_NAMES.flatMap(name =>
CONFIG_EXTENSIONS.map(ext => name + ext),
)
-const WORKSPACES_EXTENSIONS = [...CONFIG_EXTENSIONS, '.json']
-
-export const workspacesFiles: string[] = WORKSPACES_NAMES.flatMap(name =>
- WORKSPACES_EXTENSIONS.map(ext => name + ext),
-)
-
export const globalApis: string[] = [
// suite
'suite',
diff --git a/packages/vitest/src/node/cli/cli-config.ts b/packages/vitest/src/node/cli/cli-config.ts
index b9e119193b50..1b3966da0179 100644
--- a/packages/vitest/src/node/cli/cli-config.ts
+++ b/packages/vitest/src/node/cli/cli-config.ts
@@ -334,11 +334,6 @@ export const cliOptionsConfig: VitestCLIOptions = {
description: 'Override Vite mode (default: `test` or `benchmark`)',
argument: '',
},
- workspace: {
- description: '[deprecated] Path to a workspace configuration file',
- argument: '',
- normalize: true,
- },
isolate: {
description:
'Run every test file in isolation. To disable isolation, use `--no-isolate` (default: `true`)',
diff --git a/packages/vitest/src/node/config/resolveConfig.ts b/packages/vitest/src/node/config/resolveConfig.ts
index a88e9d4bb5f9..dd17b9c35132 100644
--- a/packages/vitest/src/node/config/resolveConfig.ts
+++ b/packages/vitest/src/node/config/resolveConfig.ts
@@ -21,7 +21,6 @@ import {
defaultInspectPort,
defaultPort,
extraInlineDeps,
- workspacesFiles,
} from '../../constants'
import { benchmarkConfigDefaults, configDefaults } from '../../defaults'
import { isCI, stdProvider } from '../../utils/env'
@@ -387,7 +386,6 @@ export function resolveConfig(
// Configs
resolved.config && slash(resolved.config),
...configFiles,
- ...workspacesFiles,
// Vite internal
'**\/virtual:*',
@@ -598,14 +596,6 @@ export function resolveConfig(
}
}
- if (typeof resolved.workspace === 'string') {
- // if passed down from the CLI and it's relative, resolve relative to CWD
- resolved.workspace
- = typeof options.workspace === 'string' && options.workspace[0] === '.'
- ? resolve(process.cwd(), options.workspace)
- : resolvePath(resolved.workspace, resolved.root)
- }
-
if (!builtinPools.includes(resolved.pool as BuiltinPool)) {
resolved.pool = resolvePath(resolved.pool, resolved.root)
}
diff --git a/packages/vitest/src/node/core.ts b/packages/vitest/src/node/core.ts
index 33790a0bf0b4..362914197461 100644
--- a/packages/vitest/src/node/core.ts
+++ b/packages/vitest/src/node/core.ts
@@ -11,16 +11,15 @@ import type { ResolvedConfig, TestProjectConfiguration, UserConfig, VitestRunMod
import type { CoverageProvider } from './types/coverage'
import type { Reporter } from './types/reporter'
import type { TestRunResult } from './types/tests'
-import { promises as fs } from 'node:fs'
import { getTasks, hasFailed } from '@vitest/runner/utils'
import { SnapshotManager } from '@vitest/snapshot/manager'
import { noop, toArray } from '@vitest/utils'
-import { dirname, join, normalize, relative, resolve } from 'pathe'
+import { normalize, relative } from 'pathe'
import { ViteNodeRunner } from 'vite-node/client'
import { ViteNodeServer } from 'vite-node/server'
import { version } from '../../package.json' with { type: 'json' }
import { WebSocketReporter } from '../api/setup'
-import { defaultBrowserPort, workspacesFiles as workspaceFiles } from '../constants'
+import { defaultBrowserPort } from '../constants'
import { distDir } from '../paths'
import { wildcardPatternToRegExp } from '../utils/base'
import { convertTasksToEvents } from '../utils/tasks'
@@ -90,11 +89,6 @@ export class Vitest {
/** @internal */ closingPromise?: Promise
/** @internal */ isCancelling = false
/** @internal */ coreWorkspaceProject: TestProject | undefined
- /**
- * @internal
- * @deprecated
- */
- resolvedProjects: TestProject[] = []
/** @internal */ _browserLastPort = defaultBrowserPort
/** @internal */ _browserSessions = new BrowserSessions()
/** @internal */ _cliOptions: CliOptions = {}
@@ -114,7 +108,6 @@ export class Vitest {
private _state?: StateManager
private _cache?: VitestCache
private _snapshot?: SnapshotManager
- private _workspaceConfigPath?: string
constructor(
public readonly mode: VitestRunMode,
@@ -208,8 +201,6 @@ export class Vitest {
this.pool = undefined
this.closingPromise = undefined
this.projects = []
- this.resolvedProjects = []
- this._workspaceConfigPath = undefined
this.coverageProvider = undefined
this.runningPromise = undefined
this.coreWorkspaceProject = undefined
@@ -261,7 +252,6 @@ export class Vitest {
file = normalize(file)
const isConfig = file === server.config.configFile
|| this.projects.some(p => p.vite.config.configFile === file)
- || file === this._workspaceConfigPath
if (isConfig) {
await Promise.all(this._onRestartListeners.map(fn => fn('config')))
this.report('onServerRestart', 'config')
@@ -278,7 +268,6 @@ export class Vitest {
catch { }
const projects = await this.resolveProjects(this._cliOptions)
- this.resolvedProjects = projects
this.projects = projects
await Promise.all(projects.flatMap((project) => {
@@ -404,38 +393,10 @@ export class Vitest {
return this.runner.executeId(moduleId)
}
- private async resolveWorkspaceConfigPath(): Promise {
- if (typeof this.config.workspace === 'string') {
- return this.config.workspace
- }
-
- const configDir = this.vite.config.configFile
- ? dirname(this.vite.config.configFile)
- : this.config.root
-
- const rootFiles = await fs.readdir(configDir)
-
- const workspaceConfigName = workspaceFiles.find((configFile) => {
- return rootFiles.includes(configFile)
- })
-
- if (!workspaceConfigName) {
- return undefined
- }
-
- return join(configDir, workspaceConfigName)
- }
-
private async resolveProjects(cliOptions: UserConfig): Promise {
const names = new Set()
if (this.config.projects) {
- if (typeof this.config.workspace !== 'undefined') {
- this.logger.warn(
- 'Both `test.projects` and `test.workspace` are defined. Ignoring the `test.workspace` option.',
- )
- }
-
return resolveProjects(
this,
cliOptions,
@@ -445,57 +406,17 @@ export class Vitest {
)
}
- if (Array.isArray(this.config.workspace)) {
- this.logger.deprecate(
- 'The `test.workspace` option is deprecated and will be removed in the next major. To hide this warning, rename `test.workspace` option to `test.projects`.',
- )
- return resolveProjects(
- this,
- cliOptions,
- undefined,
- this.config.workspace,
- names,
- )
- }
-
- const workspaceConfigPath = await this.resolveWorkspaceConfigPath()
-
- this._workspaceConfigPath = workspaceConfigPath
-
- // user doesn't have a workspace config, return default project
- if (!workspaceConfigPath) {
- // user can filter projects with --project flag, `getDefaultTestProject`
- // returns the project only if it matches the filter
- const project = getDefaultTestProject(this)
- if (!project) {
- return []
- }
- return resolveBrowserProjects(this, new Set([project.name]), [project])
+ if ('workspace' in this.config) {
+ throw new Error('The `test.workspace` option was removed in Vitest 4. Please, migrate to `test.projects` instead. See https://vitest.dev/guide/projects for examples.')
}
- const configFile = this.vite.config.configFile
- ? resolve(this.vite.config.root, this.vite.config.configFile)
- : 'the root config file'
-
- this.logger.deprecate(
- `The workspace file is deprecated and will be removed in the next major. Please, use the \`test.projects\` field in ${configFile} instead.`,
- )
-
- const workspaceModule = await this.import<{
- default: TestProjectConfiguration[]
- }>(workspaceConfigPath)
-
- if (!workspaceModule.default || !Array.isArray(workspaceModule.default)) {
- throw new TypeError(`Workspace config file "${workspaceConfigPath}" must export a default array of project paths.`)
+ // user can filter projects with --project flag, `getDefaultTestProject`
+ // returns the project only if it matches the filter
+ const project = getDefaultTestProject(this)
+ if (!project) {
+ return []
}
-
- return resolveProjects(
- this,
- cliOptions,
- workspaceConfigPath,
- workspaceModule.default,
- names,
- )
+ return resolveBrowserProjects(this, new Set([project.name]), [project])
}
/**
diff --git a/packages/vitest/src/node/projects/resolveProjects.ts b/packages/vitest/src/node/projects/resolveProjects.ts
index 81637dbf87c0..82030c319910 100644
--- a/packages/vitest/src/node/projects/resolveProjects.ts
+++ b/packages/vitest/src/node/projects/resolveProjects.ts
@@ -1,6 +1,12 @@
import type { GlobOptions } from 'tinyglobby'
import type { Vitest } from '../core'
-import type { BrowserInstanceOption, ResolvedConfig, TestProjectConfiguration, UserConfig, UserWorkspaceConfig } from '../types/config'
+import type {
+ BrowserInstanceOption,
+ ResolvedConfig,
+ TestProjectConfiguration,
+ UserConfig,
+ UserWorkspaceConfig,
+} from '../types/config'
import { existsSync, promises as fs } from 'node:fs'
import os from 'node:os'
import { limitConcurrency } from '@vitest/runner/utils'
diff --git a/packages/vitest/src/node/types/config.ts b/packages/vitest/src/node/types/config.ts
index 7b74dc544114..340611c1f263 100644
--- a/packages/vitest/src/node/types/config.ts
+++ b/packages/vitest/src/node/types/config.ts
@@ -377,12 +377,6 @@ export interface InlineConfig {
*/
projects?: TestProjectConfiguration[]
- /**
- * Path to a workspace configuration file
- * @deprecated use `projects` instead
- */
- workspace?: string | TestProjectConfiguration[]
-
/**
* Update snapshot
*
@@ -1110,7 +1104,6 @@ type NonProjectOptions =
| 'maxWorkers'
| 'minWorkers'
| 'fileParallelism'
- | 'workspace'
| 'watchTriggerPatterns'
export type ProjectConfig = Omit<
diff --git a/test/config/fixtures/workspace/browser/workspace-with-browser.ts b/test/config/fixtures/workspace/browser/workspace-with-browser.ts
deleted file mode 100644
index 0ec8e172ec22..000000000000
--- a/test/config/fixtures/workspace/browser/workspace-with-browser.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-// TODO: remove when --workspace is removed
-export default [
- {
- test: {
- name: "Browser project",
- browser: {
- enabled: true,
- provider: 'webdriverio',
- instances: [{ browser: 'chrome' }]
- },
- }
- }
-]
\ No newline at end of file
diff --git a/test/config/fixtures/workspace/nested/e2e.projects.js b/test/config/fixtures/workspace/nested/e2e.projects.js
deleted file mode 100644
index 6c95de1c895f..000000000000
--- a/test/config/fixtures/workspace/nested/e2e.projects.js
+++ /dev/null
@@ -1 +0,0 @@
-export default ['project-1']
\ No newline at end of file
diff --git a/test/config/test/failures.test.ts b/test/config/test/failures.test.ts
index ebaee712485d..de2f7f0a6b70 100644
--- a/test/config/test/failures.test.ts
+++ b/test/config/test/failures.test.ts
@@ -310,7 +310,18 @@ Use either:
test('v8 coverage provider cannot be used in workspace without playwright + chromium', async () => {
const { stderr } = await runVitest({
coverage: { enabled: true },
- workspace: './fixtures/workspace/browser/workspace-with-browser.ts',
+ projects: [
+ {
+ test: {
+ name: 'Browser project',
+ browser: {
+ enabled: true,
+ provider: 'webdriverio',
+ instances: [{ browser: 'chrome' }],
+ },
+ },
+ },
+ ],
}, {}, { fails: true })
expect(stderr).toMatch(
`Error: @vitest/coverage-v8 does not work with
@@ -585,3 +596,11 @@ test('minWorkers higher than maxWorkers does not crash', async ({ skip }) => {
expect(stdout).toMatch('✓ example.test.ts > it works')
expect(stderr).toBe('')
})
+
+test('cannot set the `workspace` options', async () => {
+ const { stderr } = await runVitest({
+ // @ts-expect-error workspace was removed in Vitest 4, but we show an error
+ workspace: 'some-options',
+ })
+ expect(stderr).toContain('The `test.workspace` option was removed in Vitest 4. Please, migrate to `test.projects` instead. See https://vitest.dev/guide/projects for examples.')
+})
diff --git a/test/config/test/projects.test.ts b/test/config/test/projects.test.ts
index b3aa172f94da..373ad5330d8b 100644
--- a/test/config/test/projects.test.ts
+++ b/test/config/test/projects.test.ts
@@ -2,17 +2,6 @@ import { resolve } from 'pathe'
import { expect, it } from 'vitest'
import { runVitest } from '../../test-utils'
-it('correctly runs workspace tests when workspace config path is specified', async () => {
- // TODO: remove the test in Vitest 4
- const { stderr, stdout } = await runVitest({
- root: 'fixtures/workspace',
- workspace: 'nested/e2e.projects.js',
- })
- expect(stderr).toContain('The workspace file is deprecated and will be removed in the next major')
- expect(stdout).toContain('1 + 1 = 2')
- expect(stdout).not.toContain('2 + 2 = 4')
-})
-
it('runs the workspace if there are several vitest config files', async () => {
const { stderr, stdout } = await runVitest({
root: 'fixtures/workspace/several-configs',
diff --git a/test/coverage-test/package.json b/test/coverage-test/package.json
index 507a2855f00a..3673ab8bf093 100644
--- a/test/coverage-test/package.json
+++ b/test/coverage-test/package.json
@@ -3,8 +3,7 @@
"type": "module",
"private": true,
"scripts": {
- "test": "vitest --workspace=vitest.workspace.custom.ts",
- "vitest": "vitest"
+ "test": "vitest"
},
"devDependencies": {
"@ampproject/remapping": "^2.3.0",
diff --git a/test/coverage-test/vitest.config.ts b/test/coverage-test/vitest.config.ts
index 88e7a0e286ac..94e29fb1a6fd 100644
--- a/test/coverage-test/vitest.config.ts
+++ b/test/coverage-test/vitest.config.ts
@@ -1,9 +1,137 @@
import { defineConfig } from 'vitest/config'
+const GENERIC_TESTS = 'test/**.test.ts'
+const V8_TESTS = 'test/**.v8.test.ts'
+const ISTANBUL_TESTS = 'test/**.istanbul.test.ts'
+const CUSTOM_TESTS = 'test/**.custom.test.ts'
+const UNIT_TESTS = 'test/**.unit.test.ts'
+const BROWSER_TESTS = 'test/**.browser.test.ts'
+
+const config = defineConfig({
+ test: {
+ pool: 'threads',
+ setupFiles: ['./setup.ts'],
+ },
+})
+
export default defineConfig({
test: {
reporters: 'verbose',
isolate: false,
+ projects: [
+ // Test cases for v8-provider
+ {
+ test: {
+ ...config.test,
+ name: { label: 'v8', color: 'green' },
+ env: { COVERAGE_PROVIDER: 'v8' },
+ include: [GENERIC_TESTS, V8_TESTS],
+ exclude: [
+ ISTANBUL_TESTS,
+ UNIT_TESTS,
+ CUSTOM_TESTS,
+ BROWSER_TESTS,
+ ],
+ },
+ },
+
+ // Test cases for istanbul-provider
+ {
+ test: {
+ ...config.test,
+ name: { label: 'istanbul', color: 'magenta' },
+ env: { COVERAGE_PROVIDER: 'istanbul' },
+ include: [GENERIC_TESTS, ISTANBUL_TESTS],
+ exclude: [
+ V8_TESTS,
+ UNIT_TESTS,
+ CUSTOM_TESTS,
+ BROWSER_TESTS,
+ ],
+ },
+ },
+
+ // Test cases for custom-provider
+ {
+ test: {
+ ...config.test,
+ name: { label: 'custom', color: 'yellow' },
+ env: { COVERAGE_PROVIDER: 'custom' },
+ include: [CUSTOM_TESTS],
+ },
+ },
+
+ // Test cases for browser. Browser mode itself is activated by COVERAGE_BROWSER env var.
+ {
+ test: {
+ ...config.test,
+ name: { label: 'istanbul-browser', color: 'blue' },
+ env: { COVERAGE_PROVIDER: 'istanbul', COVERAGE_BROWSER: 'true' },
+ include: [
+ BROWSER_TESTS,
+
+ // Other non-provider-specific tests that should be run on browser mode as well
+ '**/all.test.ts',
+ '**/isolation.test.ts',
+ '**/include-exclude.test.ts',
+ '**/allow-external.test.ts',
+ '**/ignore-hints.test.ts',
+ '**/import-attributes.test.ts',
+ '**/pre-transpiled-source.test.ts',
+ '**/multi-suite.test.ts',
+ '**/setup-files.test.ts',
+ '**/results-snapshot.test.ts',
+ '**/reporters.test.ts',
+ '**/temporary-files.test.ts',
+ '**/test-reporter-conflicts.test.ts',
+ '**/vue.test.ts',
+ '**/in-source.test.ts',
+ ],
+ },
+ },
+ {
+ test: {
+ ...config.test,
+ name: { label: 'v8-browser', color: 'red' },
+ env: { COVERAGE_PROVIDER: 'v8', COVERAGE_BROWSER: 'true' },
+ include: [
+ BROWSER_TESTS,
+
+ // Other non-provider-specific tests that should be run on browser mode as well
+ '**/all.test.ts',
+ '**/isolation.test.ts',
+ '**/include-exclude.test.ts',
+ '**/allow-external.test.ts',
+ '**/ignore-hints.test.ts',
+ '**/import-attributes.test.ts',
+ '**/pre-transpiled-source.test.ts',
+ '**/multi-suite.test.ts',
+ '**/setup-files.test.ts',
+ '**/results-snapshot.test.ts',
+ '**/reporters.test.ts',
+ '**/temporary-files.test.ts',
+ '**/test-reporter-conflicts.test.ts',
+ '**/vue.test.ts',
+ '**/in-source.test.ts',
+ ],
+ },
+ },
+
+ // Test cases that aren't provider specific
+ {
+ test: {
+ ...config.test,
+ name: { label: 'unit', color: 'cyan' },
+ include: [UNIT_TESTS],
+ typecheck: {
+ enabled: true,
+ include: ['**/test/*.test-d.ts'],
+ tsconfig: '../../tsconfig.check.json',
+ ignoreSourceErrors: true,
+ },
+ },
+ },
+ ],
poolOptions: {
threads: {
// Tests may have side effects, e.g. writing files to disk,
diff --git a/test/coverage-test/vitest.workspace.custom.ts b/test/coverage-test/vitest.workspace.custom.ts
deleted file mode 100644
index 4996b88f92c5..000000000000
--- a/test/coverage-test/vitest.workspace.custom.ts
+++ /dev/null
@@ -1,136 +0,0 @@
-import type { UserWorkspaceConfig } from 'vitest/config'
-import { defineConfig } from 'vitest/config'
-
-const GENERIC_TESTS = 'test/**.test.ts'
-const V8_TESTS = 'test/**.v8.test.ts'
-const ISTANBUL_TESTS = 'test/**.istanbul.test.ts'
-const CUSTOM_TESTS = 'test/**.custom.test.ts'
-const UNIT_TESTS = 'test/**.unit.test.ts'
-const BROWSER_TESTS = 'test/**.browser.test.ts'
-
-const config = defineConfig({
- test: {
- pool: 'threads',
- setupFiles: ['./setup.ts'],
- },
-})
-
-// TODO: move when --workspace is removed
-function defineWorkspace(config: UserWorkspaceConfig[]) {
- return config
-}
-
-export default defineWorkspace([
- // Test cases for v8-provider
- {
- test: {
- ...config.test,
- name: { label: 'v8', color: 'green' },
- env: { COVERAGE_PROVIDER: 'v8' },
- include: [GENERIC_TESTS, V8_TESTS],
- exclude: [
- ISTANBUL_TESTS,
- UNIT_TESTS,
- CUSTOM_TESTS,
- BROWSER_TESTS,
- ],
- },
- },
-
- // Test cases for istanbul-provider
- {
- test: {
- ...config.test,
- name: { label: 'istanbul', color: 'magenta' },
- env: { COVERAGE_PROVIDER: 'istanbul' },
- include: [GENERIC_TESTS, ISTANBUL_TESTS],
- exclude: [
- V8_TESTS,
- UNIT_TESTS,
- CUSTOM_TESTS,
- BROWSER_TESTS,
- ],
- },
- },
-
- // Test cases for custom-provider
- {
- test: {
- ...config.test,
- name: { label: 'custom', color: 'yellow' },
- env: { COVERAGE_PROVIDER: 'custom' },
- include: [CUSTOM_TESTS],
- },
- },
-
- // Test cases for browser. Browser mode itself is activated by COVERAGE_BROWSER env var.
- {
- test: {
- ...config.test,
- name: { label: 'istanbul-browser', color: 'blue' },
- env: { COVERAGE_PROVIDER: 'istanbul', COVERAGE_BROWSER: 'true' },
- include: [
- BROWSER_TESTS,
-
- // Other non-provider-specific tests that should be run on browser mode as well
- '**/all.test.ts',
- '**/isolation.test.ts',
- '**/include-exclude.test.ts',
- '**/allow-external.test.ts',
- '**/ignore-hints.test.ts',
- '**/import-attributes.test.ts',
- '**/pre-transpiled-source.test.ts',
- '**/multi-suite.test.ts',
- '**/setup-files.test.ts',
- '**/results-snapshot.test.ts',
- '**/reporters.test.ts',
- '**/temporary-files.test.ts',
- '**/test-reporter-conflicts.test.ts',
- '**/vue.test.ts',
- '**/in-source.test.ts',
- ],
- },
- },
- {
- test: {
- ...config.test,
- name: { label: 'v8-browser', color: 'red' },
- env: { COVERAGE_PROVIDER: 'v8', COVERAGE_BROWSER: 'true' },
- include: [
- BROWSER_TESTS,
-
- // Other non-provider-specific tests that should be run on browser mode as well
- '**/all.test.ts',
- '**/isolation.test.ts',
- '**/include-exclude.test.ts',
- '**/allow-external.test.ts',
- '**/ignore-hints.test.ts',
- '**/import-attributes.test.ts',
- '**/pre-transpiled-source.test.ts',
- '**/multi-suite.test.ts',
- '**/setup-files.test.ts',
- '**/results-snapshot.test.ts',
- '**/reporters.test.ts',
- '**/temporary-files.test.ts',
- '**/test-reporter-conflicts.test.ts',
- '**/vue.test.ts',
- '**/in-source.test.ts',
- ],
- },
- },
-
- // Test cases that aren't provider specific
- {
- test: {
- ...config.test,
- name: { label: 'unit', color: 'cyan' },
- include: [UNIT_TESTS],
- typecheck: {
- enabled: true,
- include: ['**/test/*.test-d.ts'],
- tsconfig: '../../tsconfig.check.json',
- ignoreSourceErrors: true,
- },
- },
- },
-])
diff --git a/test/watch/test/config-watching.test.ts b/test/watch/test/config-watching.test.ts
index b42934a5ffe2..bbec2996dcb7 100644
--- a/test/watch/test/config-watching.test.ts
+++ b/test/watch/test/config-watching.test.ts
@@ -3,56 +3,14 @@ import { runInlineTests } from '../../test-utils'
const ts = String.raw
-test('reruns tests when configs change', async () => {
- const { fs, vitest } = await runInlineTests({
- 'vitest.workspace.ts': [
- './project-1',
- './project-2',
- ],
- 'vitest.config.ts': {},
- 'project-1/vitest.config.ts': {},
- 'project-1/basic.test.ts': ts`
- import { test } from 'vitest'
- test('basic test 1', () => {})
- `,
- 'project-2/vitest.config.ts': {},
- 'project-2/basic.test.ts': ts`
- import { test } from 'vitest'
- test('basic test 2', () => {})
- `,
- }, { watch: true })
-
- await vitest.waitForStdout('Waiting for file changes')
- vitest.resetOutput()
-
- // editing the project config should trigger a restart
- fs.editFile('./project-1/vitest.config.ts', c => `\n${c}`)
-
- await vitest.waitForStdout('Restarting due to config changes...')
- await vitest.waitForStdout('Waiting for file changes')
- vitest.resetOutput()
-
- // editing the root config should trigger a restart
- fs.editFile('./vitest.config.ts', c => `\n${c}`)
-
- await vitest.waitForStdout('Restarting due to config changes...')
- await vitest.waitForStdout('Waiting for file changes')
- vitest.resetOutput()
-
- // editing the workspace config should trigger a restart
- fs.editFile('./vitest.workspace.ts', c => `\n${c}`)
-
- await vitest.waitForStdout('Restarting due to config changes...')
- await vitest.waitForStdout('Waiting for file changes')
-})
-
test('rerun stops the previous browser server and restarts multiple times without port mismatch', async () => {
const { fs, vitest } = await runInlineTests({
- 'vitest.workspace.ts': [
- './project-1',
- ],
- 'vitest.config.ts': {},
- 'project-1/vitest.config.ts': {
+ 'vitest.config.js': {
+ test: {
+ projects: ['./project-1'],
+ },
+ },
+ 'project-1/vitest.config.js': {
test: {
browser: {
enabled: true,
@@ -72,7 +30,7 @@ test('rerun stops the previous browser server and restarts multiple times withou
vitest.resetOutput()
// editing the project config the first time restarts the browser server
- fs.editFile('./project-1/vitest.config.ts', c => `\n${c}`)
+ fs.editFile('./project-1/vitest.config.js', c => `\n${c}`)
await vitest.waitForStdout('Restarting due to config changes...')
await vitest.waitForStdout('Waiting for file changes')
@@ -82,7 +40,7 @@ test('rerun stops the previous browser server and restarts multiple times withou
vitest.resetOutput()
// editing the project the second time also restarts the server
- fs.editFile('./project-1/vitest.config.ts', c => `\n${c}`)
+ fs.editFile('./project-1/vitest.config.js', c => `\n${c}`)
await vitest.waitForStdout('Restarting due to config changes...')
await vitest.waitForStdout('Waiting for file changes')