@@ -62,6 +62,13 @@ const promises = fixtures.map((fixture) =>
62
62
this . push ( chunk . toString ( ) . replace ( / \n / gm, `\n[${ fixture } ] ` ) )
63
63
callback ( )
64
64
} ,
65
+ flush ( callback ) {
66
+ // final transform might create non-terminated line with a prefix
67
+ // so this is just to make sure we end with a newline so further writes
68
+ // to same destination stream start on a new line for better readability
69
+ this . push ( '\n' )
70
+ callback ( )
71
+ } ,
65
72
} )
66
73
console . log ( `[${ fixture } ] Running \`${ cmd } \`...` )
67
74
const output = execaCommand ( cmd , {
@@ -80,6 +87,11 @@ const promises = fixtures.map((fixture) =>
80
87
operation : 'revert' ,
81
88
} )
82
89
}
90
+ if ( output . exitCode !== 0 ) {
91
+ const errorMessage = `[${ fixture } ] 🚨 Failed to install dependencies or build a fixture`
92
+ console . error ( errorMessage )
93
+ throw new Error ( errorMessage )
94
+ }
83
95
fixtureList . delete ( fixture )
84
96
} )
85
97
} ) . finally ( ( ) => {
@@ -91,5 +103,22 @@ const promises = fixtures.map((fixture) =>
91
103
}
92
104
} ) ,
93
105
)
94
- await Promise . allSettled ( promises )
106
+ const prepareFixturesResults = await Promise . allSettled ( promises )
107
+ const failedFixturesErrors = prepareFixturesResults
108
+ . map ( ( promise ) => {
109
+ if ( promise . status === 'rejected' ) {
110
+ return promise . reason
111
+ }
112
+ return null
113
+ } )
114
+ . filter ( Boolean )
115
+
116
+ if ( failedFixturesErrors . length > 0 ) {
117
+ console . error ( 'Some fixtures failed to prepare:' )
118
+ for ( const error of failedFixturesErrors ) {
119
+ console . error ( error . message )
120
+ }
121
+ process . exit ( 1 )
122
+ }
123
+
95
124
console . log ( '🎉 All fixtures prepared' )
0 commit comments