@@ -47,7 +47,6 @@ class TestRunner {
47
47
this . logFile = join ( LOGS_DIR , `test-run-${ this . timestamp } .log` ) ;
48
48
this . deploymentSuccess = false ;
49
49
this . results = { passed : [ ] , failed : [ ] } ;
50
- this . sdkTarballPath = null ; // Store the SDK tarball path to avoid repacking
51
50
}
52
51
53
52
/**
@@ -280,63 +279,21 @@ class TestRunner {
280
279
return suites ;
281
280
}
282
281
283
- /**
284
- * Pack the local Firebase Functions SDK
285
- */
286
- async packLocalSDK ( ) {
287
- this . log ( "📦 Packing local firebase-functions SDK..." , "info" ) ;
288
-
289
- const parentDir = join ( ROOT_DIR , ".." ) ;
290
- const targetPath = join ( ROOT_DIR , "firebase-functions-local.tgz" ) ;
291
-
292
- try {
293
- // Run npm pack in parent directory
294
- const result = await this . exec ( "npm pack" , { cwd : parentDir , silent : true } ) ;
295
-
296
- // Find the generated tarball name (last line of output)
297
- const tarballName = result . stdout . trim ( ) . split ( "\n" ) . pop ( ) ;
298
-
299
- // Move to expected location
300
- const sourcePath = join ( parentDir , tarballName ) ;
301
-
302
- if ( existsSync ( sourcePath ) ) {
303
- // Remove old tarball if exists
304
- if ( existsSync ( targetPath ) ) {
305
- rmSync ( targetPath ) ;
306
- }
307
-
308
- // Move new tarball
309
- renameSync ( sourcePath , targetPath ) ;
310
- this . log ( "✓ Local SDK packed successfully" , "success" ) ;
311
- return targetPath ;
312
- } else {
313
- throw new Error ( `Tarball not found at ${ sourcePath } ` ) ;
314
- }
315
- } catch ( error ) {
316
- throw new Error ( `Failed to pack local SDK: ${ error . message } ` ) ;
317
- }
318
- }
319
-
320
282
/**
321
283
* Generate functions from templates
322
284
*/
323
285
async generateFunctions ( suiteNames ) {
324
286
this . log ( "📦 Generating functions..." , "info" ) ;
325
287
326
- // Pack local SDK unless using published version
288
+ // Use SDK tarball (must be provided via --use- published-sdk or pre-packed)
327
289
let sdkTarball ;
328
290
if ( this . usePublishedSDK ) {
329
291
sdkTarball = this . usePublishedSDK ;
330
- this . log ( ` Using published SDK: ${ sdkTarball } ` , "info" ) ;
331
- } else if ( this . sdkTarballPath ) {
332
- // Use already packed SDK
333
- sdkTarball = `file:firebase-functions-local.tgz` ;
334
- this . log ( ` Using already packed SDK: ${ this . sdkTarballPath } ` , "info" ) ;
292
+ this . log ( ` Using provided SDK: ${ sdkTarball } ` , "info" ) ;
335
293
} else {
336
- // Pack the local SDK for the first time
337
- this . sdkTarballPath = await this . packLocalSDK ( ) ;
294
+ // Default to local tarball (should be pre-packed by Cloud Build or manually)
338
295
sdkTarball = `file:firebase-functions-local.tgz` ;
339
- this . log ( ` Using local SDK: ${ this . sdkTarballPath } ` , "info" ) ;
296
+ this . log ( ` Using local SDK: firebase-functions-local.tgz ` , "info" ) ;
340
297
}
341
298
342
299
try {
@@ -834,11 +791,9 @@ class TestRunner {
834
791
await this . cleanupExistingResources ( ) ;
835
792
}
836
793
837
- // Pack the SDK once for all suites (unless using published SDK)
838
- if ( ! this . usePublishedSDK && ! this . sdkTarballPath ) {
839
- this . log ( "📦 Packing SDK once for all suites..." , "info" ) ;
840
- this . sdkTarballPath = await this . packLocalSDK ( ) ;
841
- this . log ( `✓ SDK packed and will be reused for all suites` , "success" ) ;
794
+ // SDK should be pre-packed (by Cloud Build or manually)
795
+ if ( ! this . usePublishedSDK ) {
796
+ this . log ( "📦 Using pre-packed SDK for all suites..." , "info" ) ;
842
797
}
843
798
844
799
// Run each suite
@@ -1028,7 +983,7 @@ async function main() {
1028
983
console . log ( " --exclude=PATTERN Skip suites matching pattern" ) ;
1029
984
console . log ( " --test-run-id=ID Use specific TEST_RUN_ID" ) ;
1030
985
console . log (
1031
- " --use-published-sdk=VER Use published SDK version instead of local (default: pack local)"
986
+ " --use-published-sdk=VER Use published SDK version instead of local (default: use pre-packed local)"
1032
987
) ;
1033
988
console . log ( " --save-artifact Save test metadata for future cleanup" ) ;
1034
989
console . log ( " --skip-cleanup Skip pre-run cleanup (sequential mode only)" ) ;
0 commit comments