@jterrazz/test 12.2.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,20 +76,18 @@ test('builds the project', async () => {
76
76
  });
77
77
  ```
78
78
 
79
- A CLI session can also BE the spec file. A literate `<case>.cli` states one scenario — the narrative in its header, the session in its blocks — and runs either as a test file of its own (the `literate()` vite plugin) or through `cli.run('case.cli')`:
80
-
81
- ```
82
- test: refuses to build without a manifest
83
- given: an empty working directory
84
- then: the error names the file it wanted
85
-
86
- $ build
87
- exit: 1
88
- --- stderr
89
- Error: no my-cli.yaml in the current directory
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
90
88
  ```
91
89
 
92
- Same engine as the chain, same `{{token}}` grammar, same `TEST_UPDATE=1` — which rewrites only what follows each `$`, never the header. Full grammar: [docs/04-cli.md](docs/04-cli.md#literate-specs--casecli).
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).
93
91
 
94
92
  ### Website testing (browser)
95
93
 
@@ -210,7 +208,7 @@ A `JobHandle` is `{ name: string; execute: () => Promise<void> }`.
210
208
 
211
209
  ### `specification.cli(bin, { root?, services?, docker?, transform?, env?, serve? })`
212
210
 
213
- Runs a command binary against fixture projects in fresh temp directories. `env` (named environment sets) and `serve` (named servers) are the registries a [literate `<case>.cli`](docs/04-cli.md#literate-specs--casecli) 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.
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.
214
212
 
215
213
  ```typescript
216
214
  export const { cli, cleanup } = await specification.cli('my-migrate-tool', {
@@ -290,7 +288,7 @@ When `root` is absent, the framework walks up from the specification file to the
290
288
  | `.exec("args")` | cli | `CliResult` | Run the command |
291
289
  | `.exec(["build", "start"])` | cli | `CliResult` | Sequence in the same cwd; stops on first non-zero exit |
292
290
  | `.exec("dev", { waitFor, timeout? })` | cli | `CliResult` | Long-running: resolves at the pattern, killed at `timeout` (default 10 s) |
293
- | `.run("case.cli")` | cli | `CliResult` | Run a literate `<case>.cli` — its header and EVERY block asserted; the last one returns |
291
+ | `.run("case.spec.yaml")` | cli | `CliResult` | Run a `<case>.spec.yaml` — its ground and EVERY run asserted; the last one returns |
294
292
  | `.fetch(path)` | website | `FetchResult` | One raw HTTP exchange — redirects surface as 3xx, never followed |
295
293
  | `.visit(path, scenario?)` | website | `PageResult` | Render the page in a shared chromium; with a scenario, the capture is the final state |
296
294
  | `.open(deepLink?, scenario?)` | mobile | `ScreenResult` | Relaunch the app fresh on the simulator; with a scenario, the capture is the final state |