-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(workspace): support overring
pool
and poolOptions
on project …
…level (#4765)
- Loading branch information
1 parent
508fced
commit e9fe418
Showing
11 changed files
with
212 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { isMainThread } from 'node:worker_threads' | ||
import { expect, test } from 'vitest' | ||
|
||
test('is run in "node:child_process"', () => { | ||
expect(isChildProcess()).toBe(true) | ||
expect(isMainThread).toBe(true) | ||
}) | ||
|
||
// TODO: Use from "src/utils/base.ts" after #4441 | ||
function isChildProcess(): boolean { | ||
return !!process?.send | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { expect, test } from 'vitest' | ||
import type { UserConfig } from 'vitest/config' | ||
|
||
test('is isolated', () => { | ||
// @ts-expect-error -- internal | ||
const config: NonNullable<UserConfig['test']> = globalThis.__vitest_worker__.config | ||
|
||
if (config.pool === 'forks') { | ||
expect(config.poolOptions?.forks?.isolate).toBe(true) | ||
} | ||
else { | ||
expect(config.pool).toBe('threads') | ||
expect(config.poolOptions?.threads?.isolate).toBe(true) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { expect, test } from 'vitest' | ||
import type { UserConfig } from 'vitest/config' | ||
|
||
test('is multi worker', () => { | ||
// @ts-expect-error -- internal | ||
const config: NonNullable<UserConfig['test']> = globalThis.__vitest_worker__.config | ||
|
||
if (config.pool === 'forks') { | ||
expect(config.poolOptions?.forks?.singleFork).toBe(false) | ||
} | ||
else { | ||
expect(config.pool).toBe('threads') | ||
expect(config.poolOptions?.threads?.singleThread).toBe(false) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { expect, test } from 'vitest' | ||
import type { UserConfig } from 'vitest/config' | ||
|
||
test('is not isolated', () => { | ||
// @ts-expect-error -- internal | ||
const config: NonNullable<UserConfig['test']> = globalThis.__vitest_worker__.config | ||
|
||
if (config.pool === 'forks') { | ||
expect(config.poolOptions?.forks?.isolate).toBe(false) | ||
} | ||
else { | ||
expect(config.pool).toBe('threads') | ||
expect(config.poolOptions?.threads?.isolate).toBe(false) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { expect, test } from 'vitest' | ||
import type { UserConfig } from 'vitest/config' | ||
|
||
test('is single worker', () => { | ||
// @ts-expect-error -- internal | ||
const config: NonNullable<UserConfig['test']> = globalThis.__vitest_worker__.config | ||
|
||
if (config.pool === 'forks') { | ||
expect(config.poolOptions?.forks?.singleFork).toBe(true) | ||
} | ||
else { | ||
expect(config.pool).toBe('threads') | ||
expect(config.poolOptions?.threads?.singleThread).toBe(true) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { isMainThread } from 'node:worker_threads' | ||
import { expect, test } from 'vitest' | ||
|
||
test('is run in "node:worker_threads"', () => { | ||
expect(isChildProcess()).toBe(false) | ||
expect(isMainThread).toBe(false) | ||
}) | ||
|
||
// TODO: Use from "src/utils/base.ts" after #4441 | ||
function isChildProcess(): boolean { | ||
return !!process?.send | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters