File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
packages/next-plugin/src/__tests__ Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -383,6 +383,33 @@ describe('devupUICssLoader', () => {
383383 server . close ( )
384384 } )
385385
386+ it ( 'should error when readCoordinatorPort throws' , async ( ) => {
387+ const portFile = `test-coordinator-throw.port`
388+
389+ existsSyncSpy . mockImplementation ( ( p : unknown ) => p === portFile )
390+ readFileSyncSpy . mockImplementation ( ( p : unknown ) => {
391+ if ( p === portFile ) throw new Error ( 'EACCES: permission denied' )
392+ return '{}'
393+ } )
394+
395+ const error = await new Promise < Error > ( ( resolve ) => {
396+ const asyncCallback = mock ( ( err : Error | null ) => {
397+ if ( err ) resolve ( err )
398+ } )
399+ devupUICssLoader . bind ( {
400+ async : ( ) => asyncCallback ,
401+ addContextDependency : mock ( ) ,
402+ getOptions : ( ) => ( {
403+ ...defaultOptions ,
404+ coordinatorPortFile : portFile ,
405+ } ) ,
406+ resourcePath : 'devup-ui.css' ,
407+ } as any ) ( Buffer . from ( '' ) , '' , '' )
408+ } )
409+
410+ expect ( error . message ) . toBe ( 'EACCES: permission denied' )
411+ } )
412+
386413 it ( 'should error when coordinator connection fails' , async ( ) => {
387414 const portFile = `test-coordinator-conn-err.port`
388415
You can’t perform that action at this time.
0 commit comments