feat(runtime-adapters): Enable TypeScript decorator support for Deno and Bun runtimes and add decorator tests

This commit is contained in:
2025-11-17 01:21:20 +00:00
parent b94089652e
commit 16ca3b6374
8 changed files with 800 additions and 709 deletions

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@git.zone/tstest',
version: '2.7.0',
version: '2.8.0',
description: 'a test utility to run tests that match test/**/*.ts'
}

View File

@@ -69,6 +69,9 @@ export class BunRuntimeAdapter extends RuntimeAdapter {
const args: string[] = ['run'];
// Note: Bun automatically discovers bunfig.toml in the current directory
// This ensures TypeScript decorator support is enabled if bunfig.toml is present
// Add extra args
if (mergedOptions.extraArgs && mergedOptions.extraArgs.length > 0) {
args.push(...mergedOptions.extraArgs);

View File

@@ -31,8 +31,20 @@ export class DenoRuntimeAdapter extends RuntimeAdapter {
* Get default Deno options
*/
protected getDefaultOptions(): DenoOptions {
// Auto-detect deno.json or deno.jsonc config file for TypeScript decorator support
let configPath: string | undefined;
const denoJsonPath = plugins.path.join(process.cwd(), 'deno.json');
const denoJsoncPath = plugins.path.join(process.cwd(), 'deno.jsonc');
if (plugins.smartfile.fs.fileExistsSync(denoJsonPath)) {
configPath = denoJsonPath;
} else if (plugins.smartfile.fs.fileExistsSync(denoJsoncPath)) {
configPath = denoJsoncPath;
}
return {
...super.getDefaultOptions(),
configPath,
permissions: [
'--allow-read',
'--allow-env',