@@ -193,6 +193,42 @@ describe('upload + download commands (B2Simulator)', () => {
193193 expect ( completed ) . toEqual ( expect . arrayContaining ( [ 'a.txt' , 'b.txt' ] ) )
194194 } )
195195
196+ it ( 'rethrows undefined glob upload failures' , async ( ) => {
197+ const srcDir = join ( fx . workDir , 'undefined-failure-bundle' )
198+ await mkdir ( srcDir )
199+ for ( const name of [ 'a.txt' , 'b.txt' , 'c.txt' ] ) {
200+ await writeFile ( join ( srcDir , name ) , `payload-${ name } ` )
201+ }
202+
203+ const started : string [ ] = [ ]
204+ const originalUpload = fx . bucket . upload . bind ( fx . bucket )
205+ fx . bucket . upload = async ( ...args : Parameters < typeof fx . bucket . upload > ) => {
206+ const fileName = args [ 0 ] . fileName
207+ started . push ( fileName )
208+ if ( fileName === 'a.txt' ) {
209+ throw undefined
210+ }
211+ await new Promise ( ( resolve ) => setTimeout ( resolve , 25 ) )
212+ return await originalUpload ( ...args )
213+ }
214+
215+ let rejected = false
216+ try {
217+ await uploadCommand ( fx . bucket , {
218+ ...baseInputs ( ) ,
219+ source : srcDir ,
220+ concurrency : 2 ,
221+ } )
222+ } catch ( error ) {
223+ rejected = true
224+ expect ( error ) . toBeUndefined ( )
225+ }
226+
227+ expect ( rejected ) . toBe ( true )
228+ expect ( started ) . toHaveLength ( 2 )
229+ expect ( started ) . toEqual ( expect . arrayContaining ( [ 'a.txt' , 'b.txt' ] ) )
230+ } )
231+
196232 it ( 'fails when an upload glob matches no files and fail-on-empty is true' , async ( ) => {
197233 await expect (
198234 uploadCommand ( fx . bucket , {
0 commit comments