feat(runtime-adapters): Add runtime environment availability check and logger output; normalize runtime version strings
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user