Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/.vitepress/scripts/cli-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const skipConfig = new Set([
'coverage.thresholds.lines',
'standalone',
'clearScreen',
'configRunner',
'color',
'run',
'hideSkippedTests',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"tinyglobby": "^0.2.12",
"tsx": "^4.19.3",
"typescript": "^5.7.3",
"vite": "^6.0.11",
"vite": "^6.2.0",
"vitest": "workspace:*",
"zx": "^8.3.2"
},
Expand Down
1 change: 1 addition & 0 deletions packages/browser/src/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export async function createBrowserServer(
},
},
mode: project.config.mode,
configLoader: project.config.configLoader,
configFile: configPath,
// watch is handled by Vitest
server: {
Expand Down
5 changes: 5 additions & 0 deletions packages/vitest/src/node/cli/cli-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,11 @@ export const cliOptionsConfig: VitestCLIOptions = {
description:
'Clear terminal screen when re-running tests during watch mode (default: `true`)',
},
configLoader: {
description:
'Use `bundle` to bundle the config with esbuild or `runner` (experimental) to process it on the fly (default: `bundle`)',
argument: '<loader>',
},
standalone: {
description:
'Start Vitest without running tests. File filters will be ignored, tests will be running only on change (default: `false`)',
Expand Down
1 change: 1 addition & 0 deletions packages/vitest/src/node/config/resolveConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export function resolveConfig(
}

resolved.clearScreen = resolved.clearScreen ?? viteConfig.clearScreen ?? true
resolved.configLoader = resolved.configLoader ?? viteConfig.inlineConfig.configLoader ?? 'bundle'

if (options.shard) {
if (resolved.watch) {
Expand Down
1 change: 1 addition & 0 deletions packages/vitest/src/node/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export async function createVitest(

const config: ViteInlineConfig = {
configFile: configPath,
configLoader: options.configLoader,
// this will make "mode": "test" | "benchmark" inside defineConfig
mode: options.mode || mode,
plugins: await VitestPlugin(options, ctx),
Expand Down
1 change: 1 addition & 0 deletions packages/vitest/src/node/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,7 @@ export async function initializeProject(
const config: ViteInlineConfig = {
...restOptions,
configFile,
configLoader: options.test?.configLoader,
// this will make "mode": "test" | "benchmark" inside defineConfig
mode: options.test?.mode || options.mode || ctx.config.mode,
plugins: [
Expand Down
8 changes: 8 additions & 0 deletions packages/vitest/src/node/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,9 @@ export interface InlineConfig {
*/
minWorkers?: number | string

/** @experimental */
configLoader?: 'bundle' | 'runner' | 'native'

/**
* Should all test files run in parallel. Doesn't affect tests running in the same file.
* Setting this to `false` will override `maxWorkers` and `minWorkers` options to `1`.
Expand Down Expand Up @@ -945,6 +948,11 @@ export interface UserConfig extends InlineConfig {
*/
clearScreen?: boolean

/**
* Override vite config's configLoader from cli
*/
configLoader?: 'bundle' | 'runner' | 'native'

/**
* benchmark.compare option exposed at the top level for cli
*/
Expand Down
Loading