diff --git a/changelog.md b/changelog.md index 7aa093b..c5a24b8 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2025-11-17 - 2.8.2 - fix(logging) +Include runtime identifier in per-test logfile name and sanitize runtime string + +- Append a sanitized runtime identifier to the per-test log filename (format: __.log) so runs for different runtimes don't clash +- Sanitize runtime names by lowercasing and removing non-alphanumeric characters to produce filesystem-safe filenames + ## 2025-11-17 - 2.8.1 - fix(config) Remove Bun config file and set deno.json useDefineForClassFields to false for compatibility diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 024851c..00e48c1 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@git.zone/tstest', - version: '2.8.1', + version: '2.8.2', description: 'a test utility to run tests that match test/**/*.ts' } diff --git a/ts/tstest.logging.ts b/ts/tstest.logging.ts index 350aa80..71a5348 100644 --- a/ts/tstest.logging.ts +++ b/ts/tstest.logging.ts @@ -200,15 +200,18 @@ export class TsTestLogger { .replace(/\//g, '__') // Replace path separators with double underscores .replace(/\.ts$/, '') // Remove .ts extension .replace(/^\.\.__|^\.__|^__/, ''); // Clean up leading separators from relative paths - - this.currentTestLogFile = path.join('.nogit', 'testlogs', `${safeFilename}.log`); - + + // Sanitize runtime name for use in filename (lowercase, no spaces/dots/special chars) + const safeRuntime = runtime.toLowerCase().replace(/[^a-z0-9]/g, ''); + + this.currentTestLogFile = path.join('.nogit', 'testlogs', `${safeFilename}__${safeRuntime}.log`); + // Ensure the directory exists const logDir = path.dirname(this.currentTestLogFile); if (!fs.existsSync(logDir)) { fs.mkdirSync(logDir, { recursive: true }); } - + // Clear the log file for this test fs.writeFileSync(this.currentTestLogFile, ''); }