From 238831af2373ff4c30e5620f9fbd720dc14fc1cb Mon Sep 17 00:00:00 2001 From: David Snelling Date: Wed, 16 Jul 2025 11:40:42 -0700 Subject: [PATCH] **test(vitest): enhance test config with environment defaults and improved readability** - **Configuration Updates**: - Set default test environment to `node` for consistency. - Reduced noise in test outputs by configuring options such as `silent`, `bail`, `hideSkippedTests`, `printConsoleTrace`, and `onConsoleLog`. - Disabled test coverage reports by default for reduced verbosity. - Added functionality to filter out noisy console logs more aggressively. - **Purpose**: - Improves the clarity and readability of test output, reduces unnecessary verbosity, and ensures consistent behavior in a `node` environment. Encourages focus on debugging failed tests by hiding irrelevant details. --- vitest.config.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/vitest.config.ts b/vitest.config.ts index 76fce12e..c115b05b 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -9,6 +9,8 @@ export default defineConfig({ hookTimeout: 60000, // Include test files include: ['tests/**/*.{test,spec}.{js,ts}'], + // Default environment + environment: 'node', // Exclude old test files exclude: [ 'node_modules/**', @@ -23,6 +25,30 @@ export default defineConfig({ env: { FORCE_PATCHED_PLATFORM: 'true' } + }, + // Reduce noise in output + silent: false, + // Configure error display for better readability + bail: 0, + // Disable coverage reports by default to reduce noise + coverage: { + enabled: false + }, + // Reduce verbosity of test output + logHeapUsage: false, + // Only show failed tests in detail + hideSkippedTests: true, + // Reduce stack trace noise + printConsoleTrace: false, + // Filter out noisy console output more aggressively + onConsoleLog: (log: string, type: 'stdout' | 'stderr'): false | void => { + // Filter out all TensorFlow.js, model loading, and setup noise + const noisePatterns: string[] = [] + + // Return false (don't show) if log contains any noise pattern + if (noisePatterns.some((pattern) => log.includes(pattern))) { + return false + } } }, // Resolve configuration for proper module handling