File tree 5 files changed +33
-12
lines changed
5 files changed +33
-12
lines changed Original file line number Diff line number Diff line change @@ -489,6 +489,16 @@ Maximum number of threads. You can also use `VITEST_MAX_THREADS` environment var
489
489
490
490
Minimum number of threads. You can also use ` VITEST_MIN_THREADS ` environment variable.
491
491
492
+ ### useAtomics
493
+
494
+ - ** Type:** ` boolean `
495
+ - ** Default:** ` false `
496
+ - ** Version:** Since Vitest 0.28.3
497
+
498
+ Use Atomics to synchronize threads.
499
+
500
+ This can improve performance in some cases, but might cause segfault in older Node versions.
501
+
492
502
### testTimeout
493
503
494
504
- ** Type:** ` number `
Original file line number Diff line number Diff line change 133
133
"std-env" : " ^3.3.1" ,
134
134
"strip-literal" : " ^1.0.0" ,
135
135
"tinybench" : " ^2.3.1" ,
136
- "tinypool" : " ^0.3.0 " ,
136
+ "tinypool" : " ^0.3.1 " ,
137
137
"tinyspy" : " ^1.0.2" ,
138
138
"vite" : " ^3.0.0 || ^4.0.0" ,
139
139
"vite-node" : " workspace:*" ,
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ export function createPool(ctx: Vitest): WorkerPool {
43
43
filename : workerPath ,
44
44
// TODO: investigate further
45
45
// It seems atomics introduced V8 Fatal Error https://github.com/vitest-dev/vitest/issues/1191
46
- useAtomics : false ,
46
+ useAtomics : ctx . config . useAtomics ?? false ,
47
47
48
48
maxThreads,
49
49
minThreads,
@@ -141,7 +141,7 @@ export function createPool(ctx: Vitest): WorkerPool {
141
141
// node before 16.17 has a bug that causes FATAL ERROR because of the race condition
142
142
const nodeVersion = Number ( process . version . match ( / v ( \d + ) \. ( \d + ) / ) ?. [ 0 ] . slice ( 1 ) )
143
143
if ( nodeVersion >= 16.17 )
144
- await Promise . all ( pool . threads . map ( w => w . terminate ( ) ) )
144
+ await pool . destroy ( )
145
145
} ,
146
146
}
147
147
}
Original file line number Diff line number Diff line change @@ -235,6 +235,15 @@ export interface InlineConfig {
235
235
*/
236
236
minThreads ?: number
237
237
238
+ /**
239
+ * Use Atomics to synchronize threads
240
+ *
241
+ * This can improve performance in some cases, but might cause segfault in older Node versions.
242
+ *
243
+ * @default false
244
+ */
245
+ useAtomics ?: boolean
246
+
238
247
/**
239
248
* Default timeout of a test in milliseconds
240
249
*
You can’t perform that action at this time.
0 commit comments