@@ -2,44 +2,50 @@ import { Command } from 'commander';
22import { glob } from 'glob' ;
33import { spawn , spawnSync } from 'node:child_process' ;
44import * as inspector from 'node:inspector' ;
5+ import os from 'node:os' ;
56
67const IP_REGEX = / V M w a s a s s i g n e d w i t h ( .* ) I P / ;
78
89const program = new Command ( ) ;
910
1011program
12+ . option ( '--operatingSystem <operatingSystem>' , 'Operating system to run tests on' , os . platform ( ) )
1113 . argument ( '[file]' , 'File to run' )
1214 . action ( main )
1315 . parse ( )
1416
15- async function main ( argument : string ) : Promise < void > {
17+ async function main ( argument : string , operatingSystem : string ) : Promise < void > {
1618 const debug = isInDebugMode ( ) ;
1719 if ( debug ) {
1820 console . log ( 'Running in debug mode!' )
1921 }
2022
2123 if ( ! argument ) {
22- await launchTestAll ( debug )
24+ await launchTestAll ( debug , operatingSystem )
2325 return process . exit ( 0 ) ;
2426 }
2527
26- await launchSingleTest ( argument , debug ) ;
28+ await launchSingleTest ( argument , debug , operatingSystem ) ;
2729 process . exit ( 0 ) ;
2830}
2931
30- async function launchTestAll ( debug : boolean ) : Promise < void > {
32+ async function launchTestAll ( debug : boolean , operatingSystem : string ) : Promise < void > {
33+ const image = operatingSystem === 'darwin' ? 'integration_individual_test_macos' : 'integration_individual_test_linux' ;
34+
3135 const tests = await glob ( './test/**/*.test.ts' ) ;
3236 for ( const test of tests ) {
3337 console . log ( `Running test ${ test } ` )
34- await run ( `cirrus run --lazy-pull integration_individual_test_linux -e FILE_NAME="${ test } " ${ debug ? '-o simple' : '' } ` , debug , false )
38+ await run ( `cirrus run --lazy-pull ${ image } -e FILE_NAME="${ test } " ${ debug ? '-o simple' : '' } ` , debug , false )
3539 }
3640
3741 // await run('cirrus run --lazy-pull integration_test_dev -o simple', debug, false);
3842}
3943
40- async function launchSingleTest ( test : string , debug : boolean ) {
44+ async function launchSingleTest ( test : string , debug : boolean , operatingSystem : string ) {
45+ const image = operatingSystem === 'darwin' ? 'integration_individual_test_macos' : 'integration_individual_test_linux' ;
46+
4147 console . log ( `Running test: ${ test } ` )
42- await run ( `cirrus run --lazy-pull integration_individual_test -e FILE_NAME="${ test } " -o simple` , debug )
48+ await run ( `cirrus run --lazy-pull ${ image } -e FILE_NAME="${ test } " -o simple` , debug )
4349}
4450
4551async function run ( cmd : string , debug : boolean , simple = true ) {
0 commit comments