Skip to content

Commit 4d1c679

Browse files
authored
Merge pull request #5349 from Shopify/shauns/02-04-improve_vitest_performance_using_thread_pool
Improve vitest performance using thread pool
2 parents 8d9eef5 + 1786fcf commit 4d1c679

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

configurations/vite.config.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ const TIMEOUTS = {
1212
debug: 180000,
1313
}
1414

15-
export default function config(packagePath: string) {
15+
interface ConfigOptions {
16+
poolStrategy: 'threads' | 'forks'
17+
}
18+
19+
export default function config(packagePath: string, {poolStrategy}: ConfigOptions = {poolStrategy: 'threads'}) {
1620
// always treat environment as one that doesn't support hyperlinks -- otherwise assertions are hard to keep consistent
1721
process.env['FORCE_HYPERLINK'] = '0'
1822
process.env['FORCE_COLOR'] = '1'
@@ -38,7 +42,7 @@ export default function config(packagePath: string) {
3842
mockReset: true,
3943
setupFiles: [path.join(__dirname, './vitest/setup.js')],
4044
reporters: ['verbose', 'hanging-process'],
41-
threads: false,
45+
pool: poolStrategy,
4246
coverage: {
4347
provider: 'istanbul',
4448
include: ['**/src/**'],

packages/app/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import config from '../../configurations/vite.config'
22

3-
export default config(__dirname)
3+
export default config(__dirname, {poolStrategy: 'forks'})

0 commit comments

Comments
 (0)