@@ -78,7 +78,7 @@ function wrapRunner(originalPath) {
78
78
} ;
79
79
}
80
80
81
- function runJest ( ) {
81
+ function runJest ( maxWorkers ) {
82
82
return readConfig ( argv , root )
83
83
. then ( ( config ) => {
84
84
config = Object . assign ( { } , config , {
@@ -92,7 +92,7 @@ function runJest() {
92
92
hasteMap ,
93
93
config ,
94
94
{
95
- maxWorkers : Math . max ( os . cpus ( ) . length - 1 , 1 ) ,
95
+ maxWorkers : maxWorkers ,
96
96
getTestSummary : ( ) => 'You did it!'
97
97
}
98
98
) ;
@@ -119,9 +119,9 @@ function formatResults(runResults, predicate) {
119
119
return formatted . join ( '\n\n' ) ;
120
120
}
121
121
122
- function recordTests ( trackFacts ) {
122
+ function recordTests ( maxWorkers , trackFacts ) {
123
123
process . env . REACT_DOM_JEST_USE_FIBER = true ;
124
- runJest ( )
124
+ runJest ( maxWorkers )
125
125
. then ( ( runResults ) => {
126
126
const passing = formatResults (
127
127
runResults ,
@@ -169,12 +169,15 @@ function recordTests(trackFacts) {
169
169
if ( require . main === module ) {
170
170
const argv = require ( 'yargs' )
171
171
. demand ( 0 , 0 )
172
+ . number ( 'max-workers' )
173
+ . describe ( 'max-workers' , 'Number of workers to use for jest.' )
174
+ . default ( 'max-workers' , Math . max ( os . cpus ( ) . length - 1 , 1 ) )
172
175
. boolean ( 'track-facts' )
173
176
. describe ( 'track-facts' , 'Use facts-tracker to record passing tests.' )
174
177
. strict ( )
175
178
. help ( )
176
179
. argv ;
177
- recordTests ( argv . trackFacts ) ;
180
+ recordTests ( argv . maxWorkers , argv . trackFacts ) ;
178
181
}
179
182
180
183
module . exports = {
0 commit comments