- Deleted `CHANGES.md`, `CHANGES_SUMMARY.md`, `CONCURRENCY_ANALYSIS.md`, `CONCURRENCY_IMPLEMENTATION_SUMMARY.md`, and related developer documentation files. - Removed redundant or legacy content no longer aligned with the current codebase and workflows. - Updated repository to reflect streamlined documentation approach, reducing clutter and improving maintainability. **Purpose**: Simplify and declutter repository by removing obsolete documentation files, ensuring it remains focused and relevant.
226 lines
5.8 KiB
Markdown
226 lines
5.8 KiB
Markdown
# Vitest Output Improvements
|
|
|
|
## Changes Made
|
|
|
|
The Vitest configuration has been updated to provide cleaner, more focused test output that shows only successes,
|
|
failures, and a nice summary report at the end. The following changes were implemented:
|
|
|
|
### 1. Reporter Configuration
|
|
|
|
- Removed the verbose reporter which was causing excessive output
|
|
- Configured the default reporter to:
|
|
- Show a summary at the end
|
|
- Display test titles for all tests
|
|
- Use a compact output format
|
|
|
|
```javascript
|
|
reporters: [
|
|
[
|
|
'default',
|
|
{
|
|
summary: true,
|
|
reportSummary: true,
|
|
successfulTestOnly: false,
|
|
outputFile: false
|
|
}
|
|
]
|
|
]
|
|
```
|
|
|
|
### 2. Output Settings
|
|
|
|
- Set `hideSkippedTests: true` to reduce noise from skipped tests
|
|
- Set `printConsoleTrace: false` to only show stack traces for failed tests
|
|
- Added output formatting options:
|
|
```javascript
|
|
outputDiffLines: 5; // Limit diff output lines for cleaner error reports
|
|
outputFileMaxLines: 40; // Limit file output lines for cleaner error reports
|
|
outputTruncateLength: 80; // Truncate long output lines
|
|
```
|
|
|
|
### 3. Console Output Filtering
|
|
|
|
Enhanced the `onConsoleLog` function to be more aggressive in filtering out unnecessary output:
|
|
|
|
- Added filtering for stdout logs to only show errors, failures, warnings, and test results
|
|
- Expanded the noise patterns list to filter out more common noise sources
|
|
- Added explicit handling to show logs that pass all filters
|
|
|
|
## Results
|
|
|
|
The test output is now much cleaner and more focused:
|
|
|
|
1. Only shows important information like test successes and failures
|
|
2. Displays stderr messages only when relevant (e.g., for error handling tests)
|
|
3. Provides a clean, readable summary at the end showing:
|
|
- Number of test files passed
|
|
- Number of tests passed
|
|
- Duration information
|
|
- Start time
|
|
|
|
## How to Run Tests
|
|
|
|
Use the standard npm test commands:
|
|
|
|
```bash
|
|
# Run all tests
|
|
npm test
|
|
|
|
# Run specific test file
|
|
npm test -- tests/core.test.ts
|
|
|
|
# Run tests in watch mode
|
|
npm run test:watch
|
|
```
|
|
|
|
## Recent Improvements (July 2025)
|
|
|
|
The Vitest configuration has been further enhanced to provide more detailed reporting and better console output suppression:
|
|
|
|
### 1. Multiple Reporters
|
|
|
|
Added multiple reporters to provide different levels of detail:
|
|
|
|
```javascript
|
|
reporters: [
|
|
// Default reporter for basic progress and summary
|
|
[
|
|
'default',
|
|
{
|
|
summary: true,
|
|
reportSummary: true,
|
|
successfulTestOnly: false,
|
|
outputFile: false
|
|
}
|
|
],
|
|
// Verbose reporter for detailed information about failures
|
|
[
|
|
'verbose',
|
|
{
|
|
onError: true,
|
|
displayDiff: true,
|
|
displayErrorStacktrace: true
|
|
}
|
|
],
|
|
// JSON reporter for machine-readable output
|
|
[
|
|
'json',
|
|
{
|
|
outputFile: './test-results.json'
|
|
}
|
|
]
|
|
]
|
|
```
|
|
|
|
### 2. Enhanced Console Output Suppression
|
|
|
|
Improved the console output filtering to be more aggressive:
|
|
|
|
- Added a whitelist approach for stdout, only allowing specific test-related patterns
|
|
- Enhanced stderr filtering to only show actual errors
|
|
- Expanded the list of noise patterns to filter out common debug messages
|
|
- Added additional filtering for common debug output patterns
|
|
|
|
### 3. New Test Scripts
|
|
|
|
Added several new test scripts to provide different reporting options:
|
|
|
|
```bash
|
|
# Standard test run with default configuration
|
|
npm test
|
|
|
|
# Detailed report with verbose output
|
|
npm run test:report:detailed
|
|
|
|
# Generate JSON report for machine processing
|
|
npm run test:report:json
|
|
|
|
# Run tests in silent mode (minimal output)
|
|
npm run test:silent
|
|
|
|
# Show only progress and errors
|
|
npm run test:progress-only
|
|
```
|
|
|
|
## How to Use the New Features
|
|
|
|
### For Detailed Test Reports
|
|
|
|
When you need comprehensive information about test results, especially for failures:
|
|
|
|
```bash
|
|
npm run test:report:detailed
|
|
```
|
|
|
|
This will show detailed information about each test, including:
|
|
- Full test hierarchy
|
|
- Detailed error messages with stack traces
|
|
- Test durations
|
|
- Comprehensive summary
|
|
|
|
### For CI/CD Integration
|
|
|
|
When you need machine-readable output for integration with CI/CD systems:
|
|
|
|
```bash
|
|
npm run test:report:json
|
|
```
|
|
|
|
This generates a `test-results.json` file that can be processed by other tools.
|
|
|
|
### For Minimal Output
|
|
|
|
When you want to see only test progress without noise:
|
|
|
|
```bash
|
|
npm run test:progress-only
|
|
```
|
|
|
|
This shows only test progress indicators and critical errors.
|
|
|
|
### For Completely Silent Operation
|
|
|
|
When you want to run tests with minimal console output:
|
|
|
|
```bash
|
|
npm run test:silent
|
|
```
|
|
|
|
## Recent Improvements (July 2025)
|
|
|
|
### Pretty Test Reporter
|
|
|
|
A new visually appealing test summary reporter has been added to provide a clearer, more readable test summary. The pretty reporter:
|
|
|
|
- Uses colors and symbols to distinguish between passed, failed, and skipped tests
|
|
- Displays test results in a clean, tabular format
|
|
- Shows detailed statistics about the test run
|
|
- Clearly lists any failed tests with their error messages
|
|
|
|
To use the pretty reporter, run:
|
|
|
|
```bash
|
|
npm run test:report:pretty
|
|
```
|
|
|
|
For more details, see the [PRETTY_TEST_REPORTER.md](./PRETTY_TEST_REPORTER.md) document.
|
|
|
|
## Future Improvements
|
|
|
|
If further customization is needed, consider:
|
|
|
|
1. Creating custom HTML reports for better visualization
|
|
2. Integrating with notification systems for test failures
|
|
3. Adding performance benchmarking to the test reports
|
|
|
|
## Recent Fixes (July 2025)
|
|
|
|
### Fixed Duplicate Summary Output
|
|
|
|
The test output was showing duplicate summary information at the end of test runs. This has been fixed by:
|
|
|
|
1. Simplifying the reporters configuration to use only the necessary reporters
|
|
2. Removing the verbose reporter which was causing duplicate summary output
|
|
3. Keeping only the default reporter for console output and JSON reporter for machine-readable output
|
|
|
|
For more information about expected error messages during test runs, see the [EXPECTED_TEST_MESSAGES.md](./EXPECTED_TEST_MESSAGES.md) document.
|