@@ -9,9 +9,9 @@ mock.module('../src/disable-auto-merge', () => ({
99 disableAutoMerge : disableAutoMergeMock
1010} ) ) ;
1111
12- const globSyncMock = mock ( ) ;
12+ const globMock = mock ( ) ;
1313mock . module ( 'glob' , ( ) => ( {
14- sync : globSyncMock
14+ glob : globMock
1515} ) ) ;
1616
1717const getInputMock = mock ( ) ;
@@ -159,6 +159,8 @@ describe('main', () => {
159159 unlinkSyncMock . mockReturnValue ( undefined ) ;
160160 rmMock . mockResolvedValue ( undefined ) ;
161161
162+ globMock . mockResolvedValue ( [ ] ) ;
163+
162164 s3OperationCalls = [ ] ;
163165 } ) ;
164166
@@ -211,7 +213,7 @@ describe('main', () => {
211213 } ;
212214 getInputMock . mockImplementation ( name => extendedInputMap [ name ] ) ;
213215 execMock . mockResolvedValue ( 0 ) ;
214- globSyncMock . mockReturnValue ( [ 'path/to/screenshots/base.png' ] ) ;
216+ globMock . mockResolvedValue ( [ 'path/to/screenshots/base.png' ] ) ;
215217 await runAction ( ) ;
216218 expect ( setFailedMock ) . not . toHaveBeenCalled ( ) ;
217219 expect ( createCommitStatusMock ) . toHaveBeenCalledWith ( {
@@ -233,7 +235,7 @@ describe('main', () => {
233235
234236 it ( 'should pass if visual tests pass and no diffs or new images' , async ( ) => {
235237 execMock . mockResolvedValue ( 0 ) ;
236- globSyncMock . mockReturnValue ( [ 'path/to/screenshots/base.png' ] ) ;
238+ globMock . mockResolvedValue ( [ 'path/to/screenshots/base.png' ] ) ;
237239 await runAction ( ) ;
238240 expect ( setFailedMock ) . not . toHaveBeenCalled ( ) ;
239241 expect ( createCommitStatusMock ) . toHaveBeenCalledWith ( {
@@ -249,15 +251,15 @@ describe('main', () => {
249251 it ( 'should pass if visual tests pass and no diffs or new images with diff-id input' , async ( ) => {
250252 getInputMock . mockImplementation ( name => diffIdInputMap [ name ] ) ;
251253 execMock . mockResolvedValue ( 0 ) ;
252- globSyncMock . mockReturnValue ( [ 'path/to/screenshots/base.png' ] ) ;
254+ globMock . mockResolvedValue ( [ 'path/to/screenshots/base.png' ] ) ;
253255 await runAction ( ) ;
254256 expect ( setFailedMock ) . not . toHaveBeenCalled ( ) ;
255257 assertNoOctokitCalls ( ) ;
256258 } ) ;
257259
258260 it ( 'should fail if visual tests pass and some diff images were created' , async ( ) => {
259261 execMock . mockResolvedValue ( 1 ) ;
260- globSyncMock . mockReturnValue ( [
262+ globMock . mockResolvedValue ( [
261263 'path/to/screenshots/base.png' ,
262264 'path/to/screenshots/diff.png' ,
263265 'path/to/screenshots/new.png' ,
@@ -287,7 +289,7 @@ describe('main', () => {
287289 it ( 'should fail if visual tests pass and some diff images were created' , async ( ) => {
288290 getInputMock . mockImplementation ( name => diffIdInputMap [ name ] ) ;
289291 execMock . mockResolvedValue ( 1 ) ;
290- globSyncMock . mockReturnValue ( [
292+ globMock . mockResolvedValue ( [
291293 'path/to/screenshots/base.png' ,
292294 'path/to/screenshots/diff.png' ,
293295 'path/to/screenshots/new.png' ,
@@ -312,7 +314,7 @@ describe('main', () => {
312314 name => multiLineInputMapMultipleCommands [ name ]
313315 ) ;
314316 execMock . mockResolvedValue ( 1 ) ;
315- globSyncMock . mockReturnValue ( [
317+ globMock . mockResolvedValue ( [
316318 'path/to/screenshots/base.png' ,
317319 'path/to/screenshots/diff.png' ,
318320 'path/to/screenshots/new.png'
@@ -338,7 +340,7 @@ describe('main', () => {
338340 name => multiLineInputMapMultipleCommands [ name ]
339341 ) ;
340342 execMock . mockResolvedValue ( 1 ) ;
341- globSyncMock . mockReturnValue ( [
343+ globMock . mockResolvedValue ( [
342344 'path/to/screenshots/base.png' ,
343345 'path/to/screenshots/diff.png' ,
344346 'path/to/screenshots/new.png'
@@ -350,7 +352,7 @@ describe('main', () => {
350352
351353 it ( 'should pass if visual tests initially fail but pass on retry' , async ( ) => {
352354 execMock . mockResolvedValue ( 0 ) ;
353- globSyncMock . mockReturnValue ( [ 'path/to/screenshots/diff.png' ] ) ;
355+ globMock . mockResolvedValue ( [ 'path/to/screenshots/diff.png' ] ) ;
354356 await runAction ( ) ;
355357 expect ( setFailedMock ) . not . toHaveBeenCalled ( ) ;
356358 expect ( unlinkSyncMock ) . toHaveBeenCalledWith ( 'path/to/screenshots/diff.png' ) ;
@@ -367,7 +369,7 @@ describe('main', () => {
367369 it ( 'should pass if visual tests initially fail but pass on retry with diff-id input' , async ( ) => {
368370 getInputMock . mockImplementation ( name => diffIdInputMap [ name ] ) ;
369371 execMock . mockResolvedValue ( 0 ) ;
370- globSyncMock . mockReturnValue ( [ 'path/to/screenshots/diff.png' ] ) ;
372+ globMock . mockResolvedValue ( [ 'path/to/screenshots/diff.png' ] ) ;
371373 await runAction ( ) ;
372374 expect ( setFailedMock ) . not . toHaveBeenCalled ( ) ;
373375 expect ( unlinkSyncMock ) . toHaveBeenCalledWith ( 'path/to/screenshots/diff.png' ) ;
@@ -376,7 +378,7 @@ describe('main', () => {
376378
377379 it ( 'should pass and upload base images if visual tests pass and only new images were created' , async ( ) => {
378380 execMock . mockResolvedValue ( 0 ) ;
379- globSyncMock . mockReturnValue ( [
381+ globMock . mockResolvedValue ( [
380382 'path/to/screenshots/existingTest/base.png' ,
381383 'path/to/screenshots/newTest1/new.png' ,
382384 'path/to/screenshots/newTest2/new.png'
@@ -401,7 +403,7 @@ describe('main', () => {
401403 it ( 'should pass and upload base images if visual tests pass and only new images were created with diff-id input' , async ( ) => {
402404 getInputMock . mockImplementation ( name => diffIdInputMap [ name ] ) ;
403405 execMock . mockResolvedValue ( 0 ) ;
404- globSyncMock . mockReturnValue ( [
406+ globMock . mockResolvedValue ( [
405407 'path/to/screenshots/existingTest/base.png' ,
406408 'path/to/screenshots/newTest1/new.png' ,
407409 'path/to/screenshots/newTest2/new.png'
@@ -422,7 +424,7 @@ describe('main', () => {
422424 'package-paths' : 'path/1,path/2'
423425 } ;
424426 getInputMock . mockImplementation ( name => extendedInputMap [ name ] ) ;
425- globSyncMock . mockReturnValue ( [
427+ globMock . mockResolvedValue ( [
426428 'path/to/screenshots/base.png' ,
427429 'path/to/screenshots/diff.png' ,
428430 'path/to/screenshots/new.png'
@@ -439,7 +441,7 @@ describe('main', () => {
439441 'package-paths' : 'path/1,path/2'
440442 } ;
441443 getInputMock . mockImplementation ( name => extendedInputMap [ name ] ) ;
442- globSyncMock . mockReturnValue ( [
444+ globMock . mockResolvedValue ( [
443445 'path/to/screenshots/base.png' ,
444446 'path/to/screenshots/diff.png' ,
445447 'path/to/screenshots/new.png'
@@ -455,7 +457,7 @@ describe('main', () => {
455457 execMock . mockResolvedValue ( 0 ) ;
456458 getInputMock . mockImplementation ( name => inputMap [ name ] ) ;
457459 getBooleanInputMock . mockImplementation ( ( ) => downloadBaseImages ) ;
458- globSyncMock . mockReturnValue ( [
460+ globMock . mockResolvedValue ( [
459461 'path/to/screenshots/base.png' ,
460462 'path/to/screenshots/diff.png' ,
461463 'path/to/screenshots/new.png'
@@ -469,7 +471,7 @@ describe('main', () => {
469471 execMock . mockResolvedValue ( 0 ) ;
470472 getInputMock . mockImplementation ( name => inputMap [ name ] ) ;
471473 getBooleanInputMock . mockImplementation ( ( ) => downloadBaseImages ) ;
472- globSyncMock . mockReturnValue ( [
474+ globMock . mockResolvedValue ( [
473475 'path/to/screenshots/base.png' ,
474476 'path/to/screenshots/diff.png' ,
475477 'path/to/screenshots/new.png'
@@ -496,7 +498,7 @@ describe('main', () => {
496498 'package-paths' : 'path/1,path/2'
497499 } ;
498500 getInputMock . mockImplementation ( name => extendedInputMap [ name ] ) ;
499- globSyncMock . mockReturnValue ( [
501+ globMock . mockResolvedValue ( [
500502 'path/to/screenshots/base.png' ,
501503 'path/to/screenshots/diff.png' ,
502504 'path/to/screenshots/new.png'
@@ -508,7 +510,7 @@ describe('main', () => {
508510
509511 it ( 'should not set successful commit status or create comment if the latest Visual Regression status is failure' , async ( ) => {
510512 execMock . mockResolvedValue ( 0 ) ;
511- globSyncMock . mockReturnValue ( [ 'path/to/screenshots/base.png' ] ) ;
513+ globMock . mockResolvedValue ( [ 'path/to/screenshots/base.png' ] ) ;
512514 listCommitStatusesForRefMock . mockImplementationOnce ( ( ) => ( {
513515 data : [
514516 {
@@ -536,7 +538,7 @@ describe('main', () => {
536538
537539 it ( 'should not set successful commit status if the latest Visual Regression status has been set' , async ( ) => {
538540 execMock . mockResolvedValue ( 0 ) ;
539- globSyncMock . mockReturnValue ( [ 'path/to/screenshots/base.png' ] ) ;
541+ globMock . mockResolvedValue ( [ 'path/to/screenshots/base.png' ] ) ;
540542 listCommitStatusesForRefMock . mockImplementationOnce ( ( ) => ( {
541543 data : [
542544 {
@@ -562,7 +564,7 @@ describe('main', () => {
562564
563565 it ( 'should not set commit status or create comment if the latest Visual Regression status is failure because tests failed to execute successfully' , async ( ) => {
564566 execMock . mockResolvedValue ( 1 ) ;
565- globSyncMock . mockReturnValue ( [
567+ globMock . mockResolvedValue ( [
566568 'path/to/screenshots/base.png' ,
567569 'path/to/screenshots/diff.png' ,
568570 'path/to/screenshots/new.png'
@@ -596,7 +598,7 @@ describe('main', () => {
596598 it ( 'should set successful commit status (and disable auto merge) if a visual test failed to execute but this is a re-run' , async ( ) => {
597599 githubContext . runAttempt = 2 ;
598600 execMock . mockResolvedValue ( 0 ) ;
599- globSyncMock . mockReturnValue ( [ 'path/to/screenshots/base.png' ] ) ;
601+ globMock . mockResolvedValue ( [ 'path/to/screenshots/base.png' ] ) ;
600602 listCommitStatusesForRefMock . mockImplementationOnce ( ( ) => ( {
601603 data : [
602604 {
@@ -625,7 +627,7 @@ describe('main', () => {
625627 it ( 'should set failure commit status (and not disable auto merge) if a visual test failed to execute but this is a re-run' , async ( ) => {
626628 githubContext . runAttempt = 2 ;
627629 execMock . mockResolvedValue ( 1 ) ;
628- globSyncMock . mockReturnValue ( [
630+ globMock . mockResolvedValue ( [
629631 'path/to/screenshots/base.png' ,
630632 'path/to/screenshots/diff.png' ,
631633 'path/to/screenshots/new.png'
0 commit comments