@@ -78,7 +78,7 @@ function wrapRunner(originalPath) {
7878 } ;
7979}
8080
81- function runJest ( ) {
81+ function runJest ( maxWorkers ) {
8282 return readConfig ( argv , root )
8383 . then ( ( config ) => {
8484 config = Object . assign ( { } , config , {
@@ -92,7 +92,7 @@ function runJest() {
9292 hasteMap ,
9393 config ,
9494 {
95- maxWorkers : Math . max ( os . cpus ( ) . length - 1 , 1 ) ,
95+ maxWorkers : maxWorkers ,
9696 getTestSummary : ( ) => 'You did it!'
9797 }
9898 ) ;
@@ -119,9 +119,9 @@ function formatResults(runResults, predicate) {
119119 return formatted . join ( '\n\n' ) ;
120120}
121121
122- function recordTests ( trackFacts ) {
122+ function recordTests ( maxWorkers , trackFacts ) {
123123 process . env . REACT_DOM_JEST_USE_FIBER = true ;
124- runJest ( )
124+ runJest ( maxWorkers )
125125 . then ( ( runResults ) => {
126126 const passing = formatResults (
127127 runResults ,
@@ -169,12 +169,15 @@ function recordTests(trackFacts) {
169169if ( require . main === module ) {
170170 const argv = require ( 'yargs' )
171171 . 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 ) )
172175 . boolean ( 'track-facts' )
173176 . describe ( 'track-facts' , 'Use facts-tracker to record passing tests.' )
174177 . strict ( )
175178 . help ( )
176179 . argv ;
177- recordTests ( argv . trackFacts ) ;
180+ recordTests ( argv . maxWorkers , argv . trackFacts ) ;
178181}
179182
180183module . exports = {
0 commit comments