@@ -6,6 +6,7 @@ import { AppDistributionClient } from "../appdistribution/client";
66import { getAppName , ensureFileExists } from "../appdistribution/options-parser-util" ;
77import { TestCase } from "../appdistribution/types" ;
88import * as utils from "../utils" ;
9+ import { FirebaseError } from "../error" ;
910
1011export const command = new Command ( "appdistribution:testcases:import <test-cases-yaml-file>" )
1112 . description ( "import test cases from YAML file" )
@@ -19,9 +20,19 @@ export const command = new Command("appdistribution:testcases:import <test-cases
1920 const testCasesWithoutName = testCases . filter ( ( tc ) => ! tc . name ) ;
2021 // nothing can depend on these test cases yet, since they don't have
2122 // resource names
22- await Promise . all (
23+ const creationResults = await Promise . allSettled (
2324 testCasesWithoutName . map ( ( tc ) => appDistroClient . createTestCase ( appName , tc ) ) ,
2425 ) ;
26+ const failed = creationResults . filter ( ( r ) => r . status === "rejected" ) ;
27+ if ( failed . length > 0 ) {
28+ for ( const f of failed ) {
29+ utils . logWarning ( ( f as any ) . reason ) ;
30+ }
31+ const succeeded = creationResults . length - failed . length ;
32+ throw new FirebaseError (
33+ `Created ${ succeeded } test case(s), but failed to create ${ failed . length } .` ,
34+ ) ;
35+ }
2536 // any test case with a resource name can be referenced by any other new or
2637 // existing test case, so we need to batch the upsert.
2738 const testCasesWithName = testCases . filter ( ( tc ) => ! ! tc . name ) ;
0 commit comments