feat(runtime-adapters): Add runtime environment availability check and logger output; normalize runtime version strings

This commit is contained in:
2025-10-17 07:09:25 +00:00
parent b9fd8c7b02
commit 86db2491a3
7 changed files with 64 additions and 6 deletions

View File

@@ -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<string, { available: boolean; version?: string; error?: string }>) {
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<string, string> = {
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) {