+24
-0
@@ -203,2 +203,3 @@ #!/usr/bin/env bun | ||
| console.error(' tekir build --compile Single executable (requires Bun)') | ||
| console.error(' tekir test [args] Run tests (`bun test` on Bun, `vitest run` on Node)') | ||
| console.error(' tekir <command> [args] Run a built-in / provider / user command') | ||
@@ -333,2 +334,25 @@ console.error(' tekir Alias for `tekir serve`') | ||
| // `tekir test` is a thin runner shim: it sets `NODE_ENV=test` and the | ||
| // `TEKIR_RUNNER=test` signal that `app.start()` listens for, then hands | ||
| // control to the runtime's native test command (`bun test` on Bun, | ||
| // `vitest` on Node). The signal is what lets a user entry's top-level | ||
| // `app.start()` short-circuit when imported from a test file, so the | ||
| // canonical entry shape becomes the unconditional `app.start(cb)` and | ||
| // the per-app `if (env !== 'test')` guard goes away. Integration tests | ||
| // that need a real socket pass `app.start({ force: true })` to opt back | ||
| // in. Forwarded args go to the runner verbatim (`tekir test --watch`, | ||
| // `tekir test path/to/file.test.ts`, etc.). | ||
| if (command === 'test') { | ||
| const runner = isBun ? 'bun' : 'npx' | ||
| const runnerArgs = isBun ? ['test', ...argv.slice(1)] : ['vitest', 'run', ...argv.slice(1)] | ||
| const proc = spawn(runner, runnerArgs, { | ||
| stdio: 'inherit', | ||
| env: { ...process.env, NODE_ENV: 'test', TEKIR_RUNNER: 'test' }, | ||
| }) | ||
| proc.on('exit', code => process.exit(code ?? 0)) | ||
| // The spawn keeps the parent alive until `exit` fires; falling | ||
| // through past this block would import the entry needlessly. | ||
| await new Promise(() => {}) | ||
| } | ||
| const entry = await findEntry(entryFlag, tekirCfg) | ||
@@ -335,0 +359,0 @@ const rest = argv.slice(1) |
+2
-2
| { | ||
| "name": "@tekir/cli", | ||
| "version": "0.1.3", | ||
| "version": "0.1.4", | ||
| "description": "tekir command-line tool: serve, build, generate-key, and provider-registered commands.", | ||
@@ -33,3 +33,3 @@ "author": "dev@tekir.io", | ||
| "dependencies": { | ||
| "@tekir/core": "^0.1.21" | ||
| "@tekir/core": "^0.1.28" | ||
| }, | ||
@@ -36,0 +36,0 @@ "peerDependencies": { |
19576
7.14%358
6.87%6
20%Updated