Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
b3f8a28766 | |||
86db2491a3 |
@@ -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.
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@git.zone/tstest",
|
||||
"version": "2.5.2",
|
||||
"version": "2.6.0",
|
||||
"private": false,
|
||||
"description": "a test utility to run tests that match test/**/*.ts",
|
||||
"exports": {
|
||||
|
@@ -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'
|
||||
}
|
||||
|
@@ -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 {
|
||||
|
@@ -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 {
|
||||
|
@@ -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 {
|
||||
|
@@ -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();
|
||||
|
@@ -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