mirror of
https://github.com/vitest-dev/vitest.git
synced 2026-02-01 17:36:51 +00:00
fix(config): type issue of pool and poolMatchGlobs in defineConfig (#4282)
This commit is contained in:
parent
e836b2b8bc
commit
9112cc96b4
@ -62,7 +62,7 @@ const config = {
|
||||
watch: !isCI,
|
||||
globals: false,
|
||||
environment: 'node' as const,
|
||||
pool: 'threads',
|
||||
pool: 'threads' as const,
|
||||
clearMocks: false,
|
||||
restoreMocks: false,
|
||||
mockReset: false,
|
||||
|
||||
@ -398,9 +398,6 @@ export function resolveConfig(
|
||||
return resolved
|
||||
}
|
||||
|
||||
export function isBrowserEnabled(config: ResolvedConfig) {
|
||||
if (config.browser?.enabled)
|
||||
return true
|
||||
|
||||
return config.poolMatchGlobs?.length && config.poolMatchGlobs.some(([, pool]) => pool === 'browser')
|
||||
export function isBrowserEnabled(config: ResolvedConfig): boolean {
|
||||
return Boolean(config.browser?.enabled)
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ export function createPool(ctx: Vitest): ProcessPool {
|
||||
|
||||
function getPoolName([project, file]: WorkspaceSpec) {
|
||||
for (const [glob, pool] of project.config.poolMatchGlobs || []) {
|
||||
if (pool === 'browser')
|
||||
if ((pool as Pool) === 'browser')
|
||||
throw new Error('Since Vitest 0.31.0 "browser" pool is not supported in "poolMatchGlobs". You can create a workspace to run some of your tests in browser in parallel. Read more: https://vitest.dev/guide/workspace')
|
||||
if (mm.isMatch(file, glob, { cwd: project.config.root }))
|
||||
return pool as Pool
|
||||
|
||||
@ -294,7 +294,7 @@ export interface InlineConfig {
|
||||
*
|
||||
* @default 'threads'
|
||||
*/
|
||||
pool?: Omit<Pool, 'browser'>
|
||||
pool?: Exclude<Pool, 'browser'>
|
||||
|
||||
/**
|
||||
* Pool options
|
||||
@ -314,7 +314,7 @@ export interface InlineConfig {
|
||||
* // ...
|
||||
* ]
|
||||
*/
|
||||
poolMatchGlobs?: [string, Omit<Pool, 'browser'>][]
|
||||
poolMatchGlobs?: [string, Exclude<Pool, 'browser'>][]
|
||||
|
||||
/**
|
||||
* Update snapshot
|
||||
@ -704,7 +704,7 @@ export interface UserConfig extends InlineConfig {
|
||||
shard?: string
|
||||
}
|
||||
|
||||
export interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'browser' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'benchmark' | 'shard' | 'cache' | 'sequence' | 'typecheck' | 'runner' | 'poolOptions'> {
|
||||
export interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'browser' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath' | 'benchmark' | 'shard' | 'cache' | 'sequence' | 'typecheck' | 'runner' | 'poolOptions' | 'pool'> {
|
||||
mode: VitestRunMode
|
||||
|
||||
base?: string
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user