Skip to content

Commit 89fecc3

Browse files
Claude Codeclaude
andcommitted
Address Gemini code review comments
Improvements based on Gemini's medium-priority feedback: 1. Centralize debug module imports: - test/shared/setup.mjs: Use import at top instead of require in hooks - test/unit/core/utils.test.mjs: Add import debug at top, reuse in hooks - test/unit/core/utils-enhanced.test.mjs: Add import debug at top, reuse in hooks 2. Clean up redundant configuration: - vitest.config.mjs: Remove redundant silent and reporters defaults Benefits: - Consistent ES module import style across all test files - DRY principle - import once, reuse throughout the file - Cleaner vitest configuration without unnecessary defaults All 632 tests still passing with zero debug output. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent d3b8ea9 commit 89fecc3

File tree

4 files changed

+3
-8
lines changed

4 files changed

+3
-8
lines changed

test/shared/setup.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { beforeEach, afterEach, vi } from 'vitest';
22
import { stopAllServers } from '../helpers/test-server.mjs';
3+
import debug from 'debug';
34

45
// Increase max listeners to avoid warnings when running many tests with child processes
56
// Vitest adds exit/beforeExit listeners for each test file with spawned processes
67
process.setMaxListeners(30);
78

89
// Disable debug output during tests unless explicitly enabled
910
if (!process.env.DEBUG) {
10-
const debug = require('debug');
1111
debug.disable();
1212
}
1313

@@ -30,7 +30,6 @@ afterEach(async () => {
3030

3131
// Re-disable debug after each test to prevent leakage
3232
if (!process.env.DEBUG) {
33-
const debug = require('debug');
3433
debug.disable();
3534
}
3635
});

test/unit/core/utils-enhanced.test.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
1111
import * as utils from '../../../lib/utils.js';
12+
import debug from 'debug';
1213

1314
describe('Utils Module - Enhanced Coverage', () => {
1415
describe('BufferingLogger.printOutput() behavior', () => {
@@ -20,7 +21,6 @@ describe('Utils Module - Enhanced Coverage', () => {
2021
});
2122

2223
afterEach(() => {
23-
const debug = require('debug');
2424
debug.disable();
2525
if (originalDebugEnv !== undefined) {
2626
process.env.DEBUG = originalDebugEnv;
@@ -67,7 +67,6 @@ describe('Utils Module - Enhanced Coverage', () => {
6767
});
6868

6969
afterEach(() => {
70-
const debug = require('debug');
7170
debug.disable();
7271
if (originalDebugEnv !== undefined) {
7372
process.env.DEBUG = originalDebugEnv;

test/unit/core/utils.test.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
1212
import { EventEmitter } from 'events';
1313
import * as utils from '../../../lib/utils.js';
14+
import debug from 'debug';
1415

1516
describe('Utils Module', () => {
1617
describe('noop()', () => {
@@ -251,7 +252,6 @@ describe('Utils Module', () => {
251252
});
252253

253254
afterEach(() => {
254-
const debug = require('debug');
255255
debug.disable();
256256
if (originalDebugEnv !== undefined) {
257257
process.env.DEBUG = originalDebugEnv;

vitest.config.mjs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ export default defineConfig({
1111
singleThread: true
1212
}
1313
},
14-
// Silence debug output during tests
15-
silent: false,
16-
reporters: ['default'],
1714
// Timeouts for WebSocket operations
1815
testTimeout: 15000,
1916
hookTimeout: 15000,

0 commit comments

Comments
 (0)