-
Notifications
You must be signed in to change notification settings - Fork 595
Suppress debug output during test runs #501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,8 +20,13 @@ describe('Utils Module - Enhanced Coverage', () => { | |
| }); | ||
|
|
||
| afterEach(() => { | ||
| const debug = require('debug'); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| debug.disable(); | ||
| if (originalDebugEnv !== undefined) { | ||
| process.env.DEBUG = originalDebugEnv; | ||
| if (originalDebugEnv) { | ||
| debug.enable(originalDebugEnv); | ||
| } | ||
| } else { | ||
| delete process.env.DEBUG; | ||
| } | ||
|
|
@@ -62,8 +67,13 @@ describe('Utils Module - Enhanced Coverage', () => { | |
| }); | ||
|
|
||
| afterEach(() => { | ||
| const debug = require('debug'); | ||
| debug.disable(); | ||
| if (originalDebugEnv !== undefined) { | ||
| process.env.DEBUG = originalDebugEnv; | ||
| if (originalDebugEnv) { | ||
| debug.enable(originalDebugEnv); | ||
| } | ||
| } else { | ||
| delete process.env.DEBUG; | ||
| } | ||
|
|
@@ -81,9 +91,12 @@ describe('Utils Module - Enhanced Coverage', () => { | |
|
|
||
| expect(mockLog).toHaveBeenCalled(); | ||
| // Verify the format includes timestamp and uniqueID | ||
| // printOutput calls logFunction.apply(global, args) where args includes: | ||
| // [formatString, date, uniqueID, ...originalArgs] | ||
| const firstCall = mockLog.mock.calls[0]; | ||
| expect(firstCall).toBeDefined(); | ||
| expect(firstCall[0]).toContain('test-id'); | ||
| // The uniqueID should be in args[2] (after formatString and date) | ||
| expect(firstCall[2]).toBe('test-id'); | ||
| } | ||
| }); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -251,8 +251,13 @@ describe('Utils Module', () => { | |
| }); | ||
|
|
||
| afterEach(() => { | ||
| const debug = require('debug'); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| debug.disable(); | ||
| if (originalDebugEnv !== undefined) { | ||
| process.env.DEBUG = originalDebugEnv; | ||
| if (originalDebugEnv) { | ||
| debug.enable(originalDebugEnv); | ||
| } | ||
| } else { | ||
| delete process.env.DEBUG; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,9 @@ export default defineConfig({ | |
| singleThread: true | ||
| } | ||
| }, | ||
| // Silence debug output during tests | ||
| silent: false, | ||
| reporters: ['default'], | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| // Timeouts for WebSocket operations | ||
| testTimeout: 15000, | ||
| hookTimeout: 15000, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
debugmodule is required here and again in theafterEachhook. It would be cleaner torequireit once at the top of the file and reuse the constant. Also, since this is an ES module (.mjsfile), consider usingimport debug from 'debug';instead ofrequire('debug');for consistency with the rest of the file's imports.