fix(logging): Fix log file naming to prevent collisions and update logging system documentation.

This commit is contained in:
2025-05-23 21:31:39 +00:00
parent a82fdc0f26
commit 53d3dc55e6
4 changed files with 35 additions and 5 deletions

View File

@@ -12,7 +12,7 @@ This project integrates tstest with tapbundle through a modular architecture:
### Test Execution Flow
1. **CLI Entry Point** (`cli.js` <20> `cli.ts.js` <20> `cli.child.ts`)
1. **CLI Entry Point** (`cli.js` <20> `cli.ts.js` <20> `cli.child.ts`)
- The CLI uses tsx to run TypeScript files directly
- Accepts glob patterns to find test files
- Supports options like `--verbose`, `--quiet`, `--web`
@@ -59,4 +59,19 @@ The framework automatically detects the runtime environment:
- Browser tests are compiled and served via a local server
- WebHelpers are only enabled in browser environment
This architecture allows for seamless testing across both Node.js and browser environments while maintaining a clean separation of concerns.
This architecture allows for seamless testing across both Node.js and browser environments while maintaining a clean separation of concerns.
## Logging System
### Log File Naming (Fixed in v1.9.1)
When using the `--logfile` flag, tstest creates log files in `.nogit/testlogs/`. The log file naming was updated to preserve directory structure and prevent collisions:
- **Old behavior**: `test/tapbundle/test.ts``.nogit/testlogs/test.log`
- **New behavior**: `test/tapbundle/test.ts``.nogit/testlogs/test__tapbundle__test.log`
This fix ensures that test files with the same basename in different directories don't overwrite each other's logs. The implementation:
1. Takes the relative path from the current working directory
2. Replaces path separators (`/`) with double underscores (`__`)
3. Removes the `.ts` extension
4. Creates a flat filename that preserves the directory structure