@@ -278,6 +278,11 @@ suite('Logger Test Suite', () => {
278278 // Access the private output property to ensure our mock receives all calls
279279 ( logger as any ) . output = mockOutputChannel ;
280280
281+ // Set the GUI to fully loaded so notifications work properly in tests
282+ if ( logger . Gui && typeof ( logger . Gui as any ) . updateLoadStatus === 'function' ) {
283+ ( logger . Gui as any ) . updateLoadStatus ( true ) ;
284+ }
285+
281286 // Set environment variable for development mode detection
282287 process . env . VSCODE_DEBUG_MODE = 'true' ;
283288 } ) ;
@@ -622,7 +627,8 @@ suite('Logger Test Suite', () => {
622627 const specialMessage = "Message with special chars: !@#$%^&*(){}[]|\\:;\"'<>?,./ and unicode: 🚀 ✨ 💯" ;
623628 await logger . Gui . info ( specialMessage ) ;
624629
625- assert . strictEqual ( guiMessageCalls [ 0 ] . message , specialMessage , 'Should handle special characters correctly' ) ;
630+ assert . strictEqual ( guiMessageCalls . length , 1 , 'Should have one message call' ) ;
631+ assert . strictEqual ( guiMessageCalls [ 0 ] ?. message , specialMessage , 'Should handle special characters correctly' ) ;
626632 } ) ;
627633 } ) ;
628634
@@ -928,12 +934,16 @@ suite('Logger Test Suite', () => {
928934 * @brief Tests output channel visibility in development mode
929935 * @test Validates that output channel is automatically shown in development environment
930936 */
931- test ( 'should show output channel in development mode' , ( ) => {
937+ test ( 'should show output channel in development mode' , ( done ) => {
932938 // Create logger in development mode
933939 const devContext = { extensionMode : vscode . ExtensionMode . Development } as MockExtensionContext ;
934- new ( logger . constructor as any ) ( devContext ) ;
940+ const testLogger = new ( logger . constructor as any ) ( devContext , true ) ;
935941
936- assert . strictEqual ( mockOutputChannel . _isVisible , true , 'Output channel should be visible in development mode' ) ;
942+ // The output channel show() may be asynchronous, so check after a short delay
943+ setImmediate ( ( ) => {
944+ assert . strictEqual ( mockOutputChannel . _isVisible , true , 'Output channel should be visible in development mode' ) ;
945+ done ( ) ;
946+ } ) ;
937947 } ) ;
938948
939949 /**
@@ -955,15 +965,23 @@ suite('Logger Test Suite', () => {
955965 * @brief Tests dynamic updating of installation state and context
956966 * @test Validates that logger behavior adapts when context is updated at runtime
957967 */
958- test ( 'should update installation state dynamically' , ( ) => {
968+ test ( 'should update installation state dynamically' , ( done ) => {
959969 // Create logger with undefined context
960- const testLogger = new ( logger . constructor as any ) ( undefined ) ;
970+ const testLogger = new ( logger . constructor as any ) ( undefined , true ) ;
961971
962972 // Update to development mode
963973 const devContext = { extensionMode : vscode . ExtensionMode . Development } as MockExtensionContext ;
964974 testLogger . updateInstallationState ( devContext ) ;
965975
966- assert . strictEqual ( mockOutputChannel . _isVisible , true , 'Should show output channel when updated to development mode' ) ;
976+ // updateInstallationState only updates internal state, doesn't trigger GUI changes
977+ // Need to call updateInitialisationStatus to actually show the output channel
978+ testLogger . updateInitialisationStatus ( true ) ;
979+
980+ // The output channel show() may be asynchronous, so check after a short delay
981+ setImmediate ( ( ) => {
982+ assert . strictEqual ( mockOutputChannel . _isVisible , true , 'Should show output channel when updated to development mode' ) ;
983+ done ( ) ;
984+ } ) ;
967985 } ) ;
968986 } ) ;
969987
0 commit comments