@@ -65,11 +65,18 @@ const argv = yargsParser(process.argv.slice(2), {
6565
6666 'debug' : ! ! process . env . BUILD_WORKSPACE_DIRECTORY ,
6767 'glob' : process . env . TESTBRIDGE_TEST_ONLY ,
68- 'nb-shards' : process . env . TEST_TOTAL_SHARDS ,
69- 'shard' : process . env . TEST_SHARD_INDEX ,
68+ 'nb-shards' :
69+ Number ( process . env . E2E_SHARD_TOTAL ?? 1 ) * Number ( process . env . TEST_TOTAL_SHARDS ?? 1 ) || 1 ,
70+ 'shard' :
71+ process . env . E2E_SHARD_INDEX === undefined && process . env . TEST_SHARD_INDEX === undefined
72+ ? undefined
73+ : Number ( process . env . E2E_SHARD_INDEX ?? 0 ) * Number ( process . env . E2E_SHARD_TOTAL ?? 1 ) +
74+ Number ( process . env . TEST_SHARD_INDEX ?? 0 ) ,
7075 } ,
7176} ) ;
7277
78+ console . log ( argv ) ;
79+
7380/**
7481 * Set the error code of the process to 255. This is to ensure that if something forces node
7582 * to exit without finishing properly, the error code will be 255. Right now that code is not used.
@@ -145,8 +152,8 @@ const allTests = glob
145152 } )
146153 . sort ( ) ;
147154
148- const shardId = 'shard' in argv ? Number ( argv [ 'shard' ] ) : null ; ;
149- const nbShards = ( shardId === null ) ? 1 : Number ( argv [ 'nb-shards' ] ) ;
155+ const shardId = argv [ 'shard' ] !== undefined ? Number ( argv [ 'shard' ] ) : null ;
156+ const nbShards = shardId === null ? 1 : Number ( argv [ 'nb-shards' ] ) ;
150157const tests = allTests . filter ( ( name ) => {
151158 // Check for naming tests on command line.
152159 if ( argv . _ . length == 0 ) {
@@ -170,7 +177,6 @@ if (testsToRun.length === 0) {
170177 console . log ( `No tests to run on shard ${ shardId } , exiting.` ) ;
171178 process . exit ( 0 ) ;
172179 } else {
173- console . log ( `No tests would be ran, aborting.` ) ;
174180 process . exit ( 1 ) ;
175181 }
176182}
0 commit comments