diff --git a/changelog.md b/changelog.md index 8e4dec7..e614d77 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,14 @@ # Changelog +## 2025-10-17 - 2.6.0 - feat(runtime-adapters) +Add runtime environment availability check and logger output; normalize runtime version strings + +- Introduce checkEnvironment() in TsTest and invoke it at the start of run() to detect available runtimes before executing tests. +- Add environmentCheck(availability) to TsTestLogger to print a human-friendly environment summary (with JSON and quiet-mode handling). +- Normalize reported runtime version strings from adapters: prefix Deno and Bun versions with 'v' and simplify Chromium version text. +- Display runtime availability information to the user before moving previous logs or running tests. +- Includes addition of local .claude/settings.local.json (local dev/tooling settings). + ## 2025-10-17 - 2.5.2 - fix(runtime.node) Improve Node runtime adapter to use tsrun.spawnPath, strengthen tsrun detection, and improve process lifecycle and loader handling; update tsrun dependency. diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 3dc6542..a9f737f 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.5.2', + version: '2.6.0', description: 'a test utility to run tests that match test/**/*.ts' } diff --git a/ts/tstest.classes.runtime.bun.ts b/ts/tstest.classes.runtime.bun.ts index f322ca4..63fcdb8 100644 --- a/ts/tstest.classes.runtime.bun.ts +++ b/ts/tstest.classes.runtime.bun.ts @@ -47,11 +47,11 @@ export class BunRuntimeAdapter extends RuntimeAdapter { } // Bun version is just the version number - const version = result.stdout.trim(); + const version = `v${result.stdout.trim()}`; return { available: true, - version: `Bun ${version}`, + version: version, }; } catch (error) { return { diff --git a/ts/tstest.classes.runtime.chromium.ts b/ts/tstest.classes.runtime.chromium.ts index c43dd15..9130708 100644 --- a/ts/tstest.classes.runtime.chromium.ts +++ b/ts/tstest.classes.runtime.chromium.ts @@ -37,7 +37,7 @@ export class ChromiumRuntimeAdapter extends RuntimeAdapter { // The browser binary is usually handled by @push.rocks/smartbrowser return { available: true, - version: 'Chromium (via smartbrowser)', + version: 'via smartbrowser', }; } catch (error) { return { diff --git a/ts/tstest.classes.runtime.deno.ts b/ts/tstest.classes.runtime.deno.ts index f972687..0163bc2 100644 --- a/ts/tstest.classes.runtime.deno.ts +++ b/ts/tstest.classes.runtime.deno.ts @@ -67,11 +67,11 @@ export class DenoRuntimeAdapter extends RuntimeAdapter { // Parse Deno version from output (first line is "deno X.Y.Z") const versionMatch = result.stdout.match(/deno (\d+\.\d+\.\d+)/); - const version = versionMatch ? versionMatch[1] : 'unknown'; + const version = versionMatch ? `v${versionMatch[1]}` : 'unknown'; return { available: true, - version: `Deno ${version}`, + version: version, }; } catch (error) { return { diff --git a/ts/tstest.classes.tstest.ts b/ts/tstest.classes.tstest.ts index ec0b2be..33a4380 100644 --- a/ts/tstest.classes.tstest.ts +++ b/ts/tstest.classes.tstest.ts @@ -62,7 +62,19 @@ export class TsTest { ); } + /** + * Check and display available runtimes + */ + private async checkEnvironment() { + const availability = await this.runtimeRegistry.checkAvailability(); + this.logger.environmentCheck(availability); + return availability; + } + async run() { + // Check and display environment + await this.checkEnvironment(); + // Move previous log files if --logfile option is used if (this.logger.options.logFile) { await this.movePreviousLogFiles(); diff --git a/ts/tstest.logging.ts b/ts/tstest.logging.ts index d317a24..350aa80 100644 --- a/ts/tstest.logging.ts +++ b/ts/tstest.logging.ts @@ -137,6 +137,43 @@ export class TsTestLogger { this.log(this.format(` Found: ${count} test file(s)`, 'green')); } } + + // Environment check - display available runtimes + environmentCheck(availability: Map) { + if (this.options.json) { + const runtimes: any = {}; + for (const [runtime, info] of availability) { + runtimes[runtime] = info; + } + this.logJson({ event: 'environmentCheck', runtimes }); + return; + } + + if (this.options.quiet) return; + + this.log(this.format('\nšŸŒ Test Environment', 'bold')); + + // Define runtime display names + const runtimeNames: Record = { + node: 'Node.js', + deno: 'Deno', + bun: 'Bun', + chromium: 'Chrome/Chromium' + }; + + // Display each runtime + for (const [runtime, info] of availability) { + const displayName = runtimeNames[runtime] || runtime; + + if (info.available) { + const versionStr = info.version ? ` ${info.version}` : ''; + this.log(this.format(` āœ“ ${displayName}${versionStr}`, 'green')); + } else { + const errorStr = info.error ? ` (${info.error})` : ''; + this.log(this.format(` āœ— ${displayName}${errorStr}`, 'dim')); + } + } + } // Test execution testFileStart(filename: string, runtime: string, index: number, total: number) {