@@ -311,7 +311,8 @@ describe('Inquirerer - defaultFrom feature', () => {
311311 it ( 'should use custom async resolver' , async ( ) => {
312312 const customRegistry = new DefaultResolverRegistry ( ) ;
313313 customRegistry . register ( 'custom.async' , async ( ) => {
314- return new Promise ( resolve => setTimeout ( ( ) => resolve ( 'async-result' ) , 10 ) ) ;
314+ // Return a promise without setTimeout to avoid issues with fake timers
315+ return Promise . resolve ( 'async-result' ) ;
315316 } ) ;
316317
317318 const prompter = new Inquirerer ( {
@@ -422,7 +423,9 @@ describe('Inquirerer - defaultFrom feature', () => {
422423
423424 describe ( 'interactive mode with defaultFrom' , ( ) => {
424425 it ( 'should show resolved default in prompt and allow override' , async ( ) => {
425- mockedExecSync . mockReturnValue ( Buffer . from ( 'John Doe\n' ) ) ;
426+ jest . useRealTimers ( ) ; // Use real timers for interactive tests
427+
428+ mockedExecSync . mockReturnValue ( 'John Doe\n' as any ) ;
426429
427430 enqueueInputResponse ( { type : 'read' , value : 'Custom Name' } ) ;
428431
@@ -444,10 +447,15 @@ describe('Inquirerer - defaultFrom feature', () => {
444447 const result = await prompter . prompt ( { } , questions ) ;
445448
446449 expect ( result ) . toEqual ( { authorName : 'Custom Name' } ) ;
450+
451+ jest . useFakeTimers ( ) ; // Restore fake timers
452+ jest . setSystemTime ( new Date ( '2025-11-23T15:30:45.123Z' ) ) ;
447453 } ) ;
448454
449455 it ( 'should use resolved default when user presses enter' , async ( ) => {
450- mockedExecSync . mockReturnValue ( Buffer . from ( 'John Doe\n' ) ) ;
456+ jest . useRealTimers ( ) ; // Use real timers for interactive tests
457+
458+ mockedExecSync . mockReturnValue ( 'John Doe\n' as any ) ;
451459
452460 enqueueInputResponse ( { type : 'read' , value : '' } ) ; // Empty input = use default
453461
@@ -469,11 +477,16 @@ describe('Inquirerer - defaultFrom feature', () => {
469477 const result = await prompter . prompt ( { } , questions ) ;
470478
471479 expect ( result ) . toEqual ( { authorName : 'John Doe' } ) ;
480+
481+ jest . useFakeTimers ( ) ; // Restore fake timers
482+ jest . setSystemTime ( new Date ( '2025-11-23T15:30:45.123Z' ) ) ;
472483 } ) ;
473484 } ) ;
474485
475486 describe ( 'question types with defaultFrom' , ( ) => {
476487 it ( 'should work with confirm type' , async ( ) => {
488+ jest . useRealTimers ( ) ; // Use real timers for interactive tests
489+
477490 const customRegistry = new DefaultResolverRegistry ( ) ;
478491 customRegistry . register ( 'custom.bool' , ( ) => true ) ;
479492
@@ -498,6 +511,9 @@ describe('Inquirerer - defaultFrom feature', () => {
498511 const result = await prompter . prompt ( { } , questions ) ;
499512
500513 expect ( result ) . toEqual ( { confirmed : true } ) ;
514+
515+ jest . useFakeTimers ( ) ; // Restore fake timers
516+ jest . setSystemTime ( new Date ( '2025-11-23T15:30:45.123Z' ) ) ;
501517 } ) ;
502518
503519 it ( 'should work with number type' , async ( ) => {
0 commit comments