@jterrazz/test 12.2.0 → 13.0.1
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 +12 -14
- package/dist/checker.js +554 -48
- package/dist/index.d.ts +111 -96
- package/dist/index.js +16 -14
- package/dist/literate.js +156 -164
- package/dist/match.js +60 -180
- package/dist/oxlint.cjs +83 -11
- package/dist/oxlint.js +83 -11
- package/dist/queue.js +1 -1
- package/dist/spec-document.js +536 -0
- package/dist/vitest.d.ts +3 -3
- package/dist/vitest.js +16 -15
- package/package.json +6 -4
- package/schema/spec.schema.json +179 -0
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
|
|
80
|
-
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
|
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 [
|
|
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.
|
|
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 |
|