@jterrazz/test 12.1.0 → 13.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -76,6 +76,19 @@ test('builds the project', async () => {
76
76
  });
77
77
  ```
78
78
 
79
+ A CLI session can also BE the spec file. A `<case>.spec.yaml` document states one scenario — its ground, then its runs — and executes either as a test file of its own (the `literate()` vite plugin) or through `cli.run('case.spec.yaml')`:
80
+
81
+ ```yaml
82
+ description: refuses to build without a manifest
83
+ runs:
84
+ - command: build
85
+ exit: 1
86
+ stderr: |
87
+ Error: no my-cli.yaml in the current directory
88
+ ```
89
+
90
+ Same engine as the chain, same `{{token}}` grammar, same `TEST_UPDATE=1` — which rewrites each run's exit code and streams, and nothing else. A JSON Schema ships at `@jterrazz/test/schema` so an editor validates as you type. Full grammar: [docs/04-cli.md](docs/04-cli.md#spec-documents--casespecyaml).
91
+
79
92
  ### Website testing (browser)
80
93
 
81
94
  ```typescript
@@ -193,9 +206,9 @@ const result = await jobs.seed('pending.sql').trigger('nightly-report');
193
206
 
194
207
  A `JobHandle` is `{ name: string; execute: () => Promise<void> }`.
195
208
 
196
- ### `specification.cli(bin, { root?, services?, docker?, transform? })`
209
+ ### `specification.cli(bin, { root?, services?, docker?, transform?, env?, serve? })`
197
210
 
198
- Runs a command binary against fixture projects in fresh temp directories. With `services`, connection URLs are injected into the child env automatically: `<KEY>_URL` per record key (CONSTANT_CASE at camelCase boundaries — `analyticsDb` → `ANALYTICS_DB_URL`), plus `DATABASE_URL` (exactly one SQL database) and `REDIS_URL` (exactly one redis). `.env()` overrides; `null` unsets.
211
+ Runs a command binary against fixture projects in fresh temp directories. `env` (named environment sets) and `serve` (named servers) are the registries a [`<case>.spec.yaml`](docs/04-cli.md#spec-documents--casespecyaml) names by word. With `services`, connection URLs are injected into the child env automatically: `<KEY>_URL` per record key (CONSTANT_CASE at camelCase boundaries — `analyticsDb` → `ANALYTICS_DB_URL`), plus `DATABASE_URL` (exactly one SQL database) and `REDIS_URL` (exactly one redis). `.env()` overrides; `null` unsets.
199
212
 
200
213
  ```typescript
201
214
  export const { cli, cleanup } = await specification.cli('my-migrate-tool', {
@@ -275,6 +288,7 @@ When `root` is absent, the framework walks up from the specification file to the
275
288
  | `.exec("args")` | cli | `CliResult` | Run the command |
276
289
  | `.exec(["build", "start"])` | cli | `CliResult` | Sequence in the same cwd; stops on first non-zero exit |
277
290
  | `.exec("dev", { waitFor, timeout? })` | cli | `CliResult` | Long-running: resolves at the pattern, killed at `timeout` (default 10 s) |
291
+ | `.run("case.spec.yaml")` | cli | `CliResult` | Run a `<case>.spec.yaml` — its ground and EVERY run asserted; the last one returns |
278
292
  | `.fetch(path)` | website | `FetchResult` | One raw HTTP exchange — redirects surface as 3xx, never followed |
279
293
  | `.visit(path, scenario?)` | website | `PageResult` | Render the page in a shared chromium; with a scenario, the capture is the final state |
280
294
  | `.open(deepLink?, scenario?)` | mobile | `ScreenResult` | Relaunch the app fresh on the simulator; with a scenario, the capture is the final state |