@@ -26,6 +26,8 @@ import { installWindowsZIP } from './installers/windows-zip';
2626const SUPPORTED_PLATFORMS = [ 'win32' , 'darwin' , 'linux' ] as const ;
2727const SUPPORTED_ARCHS = [ 'x64' , 'arm64' ] as const ;
2828
29+ const SUPPORTED_TESTS = [ 'time-to-first-query' , 'auto-update-from' ] as const ;
30+
2931function isSupportedPlatform (
3032 value : unknown
3133) : value is typeof SUPPORTED_PLATFORMS [ number ] {
@@ -100,7 +102,14 @@ const argv = yargs(hideBin(process.argv))
100102 . option ( 'localPackage' , {
101103 type : 'boolean' ,
102104 description : 'Use the local package instead of downloading' ,
103- } ) ;
105+ } )
106+ . option ( 'tests' , {
107+ type : 'string' ,
108+ choices : SUPPORTED_TESTS ,
109+ description : 'Which tests to run' ,
110+ } )
111+ . array ( 'tests' )
112+ . default ( 'tests' , [ ] ) ;
104113
105114type TestSubject = PackageDetails & {
106115 filepath : string ;
@@ -178,6 +187,7 @@ async function run() {
178187 'platform' ,
179188 'arch' ,
180189 'package' ,
190+ 'tests' ,
181191 ] )
182192 ) ;
183193
@@ -187,30 +197,37 @@ async function run() {
187197 const install = getInstaller ( kind ) ;
188198
189199 try {
190- const { appPath, uninstall } = install ( {
191- appName,
192- filepath,
193- destinationPath : context . sandboxPath ,
194- } ) ;
200+ if ( context . tests . length === 0 ) {
201+ console . log ( 'Warning: not performing any tests. Pass --tests.' ) ;
202+ }
203+
204+ for ( const testName of context . tests ) {
205+ const { appPath, uninstall } = install ( {
206+ appName,
207+ filepath,
208+ destinationPath : context . sandboxPath ,
209+ } ) ;
195210
196- try {
197- if ( context . platform === 'darwin' && process . env . CI ) {
198- // Auto-update does not work on mac in CI at the moment. So in that case
199- // we just run the E2E tests to make sure the app at least starts up.
200- runTimeToFirstQuery ( {
201- appName,
202- appPath,
203- } ) ;
204- } else {
205- runUpdateTest ( {
206- appName,
207- appPath,
208- autoUpdatable,
209- testName : 'AUTO_UPDATE_FROM' ,
210- } ) ;
211+ try {
212+ if ( testName === 'time-to-first-query' ) {
213+ // Auto-update does not work on mac in CI at the moment. So in that case
214+ // we just run the E2E tests to make sure the app at least starts up.
215+ runTimeToFirstQuery ( {
216+ appName,
217+ appPath,
218+ } ) ;
219+ }
220+ if ( testName === 'auto-update-from' ) {
221+ runUpdateTest ( {
222+ appName,
223+ appPath,
224+ autoUpdatable,
225+ testName,
226+ } ) ;
227+ }
228+ } finally {
229+ await uninstall ( ) ;
211230 }
212- } finally {
213- await uninstall ( ) ;
214231 }
215232 } finally {
216233 console . log ( 'Cleaning up sandbox' ) ;
0 commit comments