nukadoko 0.5.0 → 0.7.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +553 -3
- data/README.ja.md +22 -6
- data/README.md +13 -7
- data/docs/ci.ja.md +542 -0
- data/docs/ci.md +635 -0
- data/docs/commands.ja.md +1524 -0
- data/docs/commands.md +1281 -0
- data/docs/engines.json +19 -0
- data/docs/execution-events.ja.md +336 -0
- data/docs/execution-events.md +423 -0
- data/docs/glossary.json +1348 -0
- data/docs/guide.ja.md +733 -0
- data/docs/guide.md +815 -0
- data/docs/intent.ja.md +133 -0
- data/docs/intent.md +156 -0
- data/docs/layout.ja.md +442 -0
- data/docs/layout.md +399 -0
- data/docs/releasing.ja.md +186 -0
- data/docs/releasing.md +237 -0
- data/docs/ruby/reference.ja.md +302 -0
- data/docs/ruby/reference.md +368 -0
- data/docs/spec.ja.md +8916 -0
- data/docs/spec.md +11250 -0
- data/docs/tutorial.ja.md +451 -0
- data/docs/tutorial.md +458 -0
- data/docs/typescript/adopting.ja.md +231 -0
- data/docs/typescript/adopting.md +251 -0
- data/docs/typescript/doors.ja.md +301 -0
- data/docs/typescript/doors.md +329 -0
- data/docs/typescript/migration-playwright-test.ja.md +189 -0
- data/docs/typescript/migration-playwright-test.md +212 -0
- data/docs/typescript/migration.ja.md +391 -0
- data/docs/typescript/migration.md +505 -0
- data/docs/typescript/reference.ja.md +176 -0
- data/docs/typescript/reference.md +197 -0
- data/docs/typescript/upgrading.ja.md +1774 -0
- data/docs/typescript/upgrading.md +2224 -0
- data/docs/web-app.ja.md +627 -0
- data/docs/web-app.md +659 -0
- data/docs/writing-scenarios.ja.md +544 -0
- data/docs/writing-scenarios.md +563 -0
- data/lib/nukadoko/base.rb +12 -5
- data/lib/nukadoko/changed_files.rb +95 -0
- data/lib/nukadoko/check.rb +459 -51
- data/lib/nukadoko/claim_drops.rb +271 -0
- data/lib/nukadoko/claim_line.rb +24 -4
- data/lib/nukadoko/claim_rules.rb +143 -1
- data/lib/nukadoko/claim_sides.rb +157 -9
- data/lib/nukadoko/cli.rb +403 -50
- data/lib/nukadoko/codes.json +246 -21
- data/lib/nukadoko/codes.rb +21 -4
- data/lib/nukadoko/command.rb +120 -13
- data/lib/nukadoko/command_help.rb +128 -0
- data/lib/nukadoko/compat.rb +469 -0
- data/lib/nukadoko/criteria.rb +1 -1
- data/lib/nukadoko/definition.rb +157 -7
- data/lib/nukadoko/error_frames.rb +6 -3
- data/lib/nukadoko/events/count.rb +146 -0
- data/lib/nukadoko/events/counted.rb +114 -0
- data/lib/nukadoko/events/format.rb +257 -0
- data/lib/nukadoko/events/lists.rb +154 -0
- data/lib/nukadoko/events/path.rb +285 -0
- data/lib/nukadoko/events/read.rb +284 -0
- data/lib/nukadoko/events/reader.rb +490 -0
- data/lib/nukadoko/events/selection.rb +252 -0
- data/lib/nukadoko/events/tally.rb +438 -0
- data/lib/nukadoko/features.rb +2 -2
- data/lib/nukadoko/fixtures.rb +160 -35
- data/lib/nukadoko/http_recording.rb +6 -2
- data/lib/nukadoko/intent.rb +364 -0
- data/lib/nukadoko/intent_file.rb +81 -0
- data/lib/nukadoko/intent_view.rb +190 -0
- data/lib/nukadoko/js_json.rb +2 -1
- data/lib/nukadoko/judge.rb +2 -2
- data/lib/nukadoko/judgment_file.rb +22 -1
- data/lib/nukadoko/judgments.rb +33 -3
- data/lib/nukadoko/measure_mcp.rb +202 -0
- data/lib/nukadoko/parts.rb +8 -2
- data/lib/nukadoko/path_view.rb +252 -0
- data/lib/nukadoko/place_rows.rb +161 -0
- data/lib/nukadoko/program.rb +1265 -51
- data/lib/nukadoko/program_log.rb +122 -0
- data/lib/nukadoko/program_shape.rb +385 -0
- data/lib/nukadoko/project_fixtures.rb +43 -10
- data/lib/nukadoko/project_program.rb +5 -4
- data/lib/nukadoko/repeated_prefix.rb +310 -0
- data/lib/nukadoko/report_run.rb +3 -3
- data/lib/nukadoko/run.rb +1156 -159
- data/lib/nukadoko/run_record.rb +70 -46
- data/lib/nukadoko/scaffold.rb +24 -6
- data/lib/nukadoko/schema.rb +15 -2
- data/lib/nukadoko/secrets.rb +55 -5
- data/lib/nukadoko/states.rb +478 -0
- data/lib/nukadoko/step.rb +71 -2
- data/lib/nukadoko/step_fixtures.rb +52 -3
- data/lib/nukadoko/summary.rb +803 -30
- data/lib/nukadoko/table.rb +4 -2
- data/lib/nukadoko/text_fit.rb +20 -7
- data/lib/nukadoko/trace.rb +152 -45
- data/lib/nukadoko/tree_passes.rb +95 -33
- data/lib/nukadoko/underneath.rb +311 -0
- data/lib/nukadoko/verdict.rb +18 -1
- data/lib/nukadoko/version.rb +1 -1
- data/lib/nukadoko/vocabulary.rb +166 -23
- data/lib/nukadoko/walk.rb +2 -2
- data/lib/nukadoko/walk_step.rb +1 -1
- data/lib/nukadoko.rb +23 -0
- data/llms.txt +42 -35
- data/sig/generated/nukadoko/base.rbs +4 -4
- data/sig/generated/nukadoko/changed_files.rbs +42 -0
- data/sig/generated/nukadoko/check.rbs +147 -10
- data/sig/generated/nukadoko/claim_drops.rbs +135 -0
- data/sig/generated/nukadoko/claim_line.rbs +11 -0
- data/sig/generated/nukadoko/claim_rules.rbs +49 -4
- data/sig/generated/nukadoko/claim_sides.rbs +63 -12
- data/sig/generated/nukadoko/cli.rbs +80 -7
- data/sig/generated/nukadoko/codes.rbs +19 -4
- data/sig/generated/nukadoko/command.rbs +68 -1
- data/sig/generated/nukadoko/command_help.rbs +18 -0
- data/sig/generated/nukadoko/compat.rbs +392 -0
- data/sig/generated/nukadoko/criteria.rbs +1 -1
- data/sig/generated/nukadoko/definition.rbs +50 -0
- data/sig/generated/nukadoko/error_frames.rbs +1 -1
- data/sig/generated/nukadoko/events/count.rbs +69 -0
- data/sig/generated/nukadoko/events/counted.rbs +70 -0
- data/sig/generated/nukadoko/events/format.rbs +163 -0
- data/sig/generated/nukadoko/events/lists.rbs +47 -0
- data/sig/generated/nukadoko/events/path.rbs +161 -0
- data/sig/generated/nukadoko/events/read.rbs +109 -0
- data/sig/generated/nukadoko/events/reader.rbs +226 -0
- data/sig/generated/nukadoko/events/selection.rbs +100 -0
- data/sig/generated/nukadoko/events/tally.rbs +227 -0
- data/sig/generated/nukadoko/features.rbs +6 -4
- data/sig/generated/nukadoko/fixtures.rbs +67 -11
- data/sig/generated/nukadoko/http_recording.rbs +1 -1
- data/sig/generated/nukadoko/intent.rbs +132 -0
- data/sig/generated/nukadoko/intent_file.rbs +46 -0
- data/sig/generated/nukadoko/intent_view.rbs +69 -0
- data/sig/generated/nukadoko/judgment_file.rbs +7 -1
- data/sig/generated/nukadoko/judgments.rbs +10 -0
- data/sig/generated/nukadoko/measure_mcp.rbs +104 -0
- data/sig/generated/nukadoko/parts.rbs +2 -2
- data/sig/generated/nukadoko/path_view.rbs +105 -0
- data/sig/generated/nukadoko/place_rows.rbs +43 -0
- data/sig/generated/nukadoko/program.rbs +627 -23
- data/sig/generated/nukadoko/program_log.rbs +67 -0
- data/sig/generated/nukadoko/program_shape.rbs +147 -0
- data/sig/generated/nukadoko/project_fixtures.rbs +16 -3
- data/sig/generated/nukadoko/project_program.rbs +2 -1
- data/sig/generated/nukadoko/repeated_prefix.rbs +172 -0
- data/sig/generated/nukadoko/report_run.rbs +1 -1
- data/sig/generated/nukadoko/run.rbs +286 -41
- data/sig/generated/nukadoko/run_record.rbs +20 -12
- data/sig/generated/nukadoko/scaffold.rbs +3 -0
- data/sig/generated/nukadoko/schema.rbs +5 -0
- data/sig/generated/nukadoko/secrets.rbs +26 -3
- data/sig/generated/nukadoko/states.rbs +214 -0
- data/sig/generated/nukadoko/step.rbs +58 -1
- data/sig/generated/nukadoko/step_fixtures.rbs +39 -0
- data/sig/generated/nukadoko/summary.rbs +256 -2
- data/sig/generated/nukadoko/table.rbs +3 -2
- data/sig/generated/nukadoko/trace.rbs +108 -33
- data/sig/generated/nukadoko/tree_passes.rbs +36 -8
- data/sig/generated/nukadoko/underneath.rbs +141 -0
- data/sig/generated/nukadoko/verdict.rbs +8 -0
- data/sig/generated/nukadoko/vocabulary.rbs +45 -6
- data/skills/nukadoko/SKILL.md +18 -18
- data/skills/nukadoko/references/checking-steps.md +16 -83
- data/skills/nukadoko/references/diagnosing.md +6 -6
- data/skills/nukadoko/references/done.md +22 -0
- data/skills/nukadoko/references/evidence.md +19 -6
- data/skills/nukadoko/references/exploring.md +22 -7
- data/skills/nukadoko/references/fixtures.md +12 -32
- data/skills/nukadoko/references/judgments.md +18 -0
- data/skills/nukadoko/references/maintenance.md +1 -1
- data/skills/nukadoko/references/merge-risk.md +1 -1
- data/skills/nukadoko/references/parts.md +46 -23
- data/skills/nukadoko/references/{perturbed-worlds.md → perturbed-systems.md} +30 -12
- data/skills/nukadoko/references/program.md +168 -169
- data/skills/nukadoko/references/reviewing.md +20 -20
- data/skills/nukadoko/references/ruby/checking-steps.md +106 -0
- data/skills/nukadoko/references/ruby/examples/cli.md +212 -0
- data/skills/nukadoko/references/ruby/fixtures.md +34 -0
- data/skills/nukadoko/references/ruby/program.md +112 -0
- data/skills/nukadoko/references/ruby/step-files.md +115 -0
- data/skills/nukadoko/references/running.md +34 -34
- data/skills/nukadoko/references/scenario-rules.md +7 -6
- data/skills/nukadoko/references/states.md +7 -1
- data/skills/nukadoko/references/step-files.md +41 -120
- data/skills/nukadoko/references/typescript/checking-steps.md +129 -0
- data/skills/nukadoko/references/{examples → typescript/examples}/cli.md +1 -1
- data/skills/nukadoko/references/{examples → typescript/examples}/http-api.md +6 -6
- data/skills/nukadoko/references/{examples → typescript/examples}/workflow.md +1 -1
- data/skills/nukadoko/references/typescript/fixtures.md +56 -0
- data/skills/nukadoko/references/typescript/program.md +111 -0
- data/skills/nukadoko/references/typescript/step-files.md +104 -0
- data/skills/nukadoko/references/verdicts.md +10 -10
- data/skills/nukadoko/references/writing-steps.md +67 -67
- data/skills/nukadoko/references/writing-the-feature.md +1 -1
- data/skills/nukadoko-verification/SKILL.md +13 -8
- metadata +103 -7
- data/skills/nukadoko/references/ruby.md +0 -80
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Step files in TypeScript
|
|
2
|
+
|
|
3
|
+
The rules every step follows, whatever its engine, are in `../step-files.md`.
|
|
4
|
+
This page is how a TypeScript step file writes them. Run every command as
|
|
5
|
+
`npx nuka`.
|
|
6
|
+
|
|
7
|
+
## A step file
|
|
8
|
+
|
|
9
|
+
One step per file under `featuresDir`, as the file's `default` export:
|
|
10
|
+
`defineStep({ ... })`. Discovery reads that export and nothing else, and
|
|
11
|
+
the file name is the step's name (`add-todo.ts` is `add-todo`).
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
// conformance/cases/todo/steps-ts/add-todo.ts
|
|
15
|
+
import { defineStep, z } from "nukadoko";
|
|
16
|
+
|
|
17
|
+
export default defineStep({
|
|
18
|
+
pattern: "a todo titled {title:string} is added",
|
|
19
|
+
description: "Create a todo via POST /todos and return the created record",
|
|
20
|
+
args: z.object({ title: z.string().describe("The title of the todo to create") }),
|
|
21
|
+
returns: z.object({
|
|
22
|
+
id: z.string().describe("The id the server assigned"),
|
|
23
|
+
title: z.string().describe("The title as the server stored it"),
|
|
24
|
+
done: z.boolean().describe("Whether the todo is done; false for a new one"),
|
|
25
|
+
}),
|
|
26
|
+
mutates: true,
|
|
27
|
+
async run({ request }, args) {
|
|
28
|
+
const res = await request.post("/todos", { data: { title: args.title } });
|
|
29
|
+
return res.json();
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`args` and `returns` are zod objects. `z` comes from nukadoko itself, so
|
|
35
|
+
there is nothing to install for it; a schema your project passes in from
|
|
36
|
+
its own zod has to be zod 4. `mutates` defaults to true, so a writing step
|
|
37
|
+
can leave it out; a step that only reads says `mutates: false`.
|
|
38
|
+
`pattern` is one string. `patterns: [...]` answers more than one line, and
|
|
39
|
+
a step with neither is reached only by name.
|
|
40
|
+
|
|
41
|
+
## Loading
|
|
42
|
+
|
|
43
|
+
Step files end in `.ts`, except in a CommonJS project (no
|
|
44
|
+
`"type": "module"` in `package.json`), where they end in `.mts`. Under
|
|
45
|
+
`"type": "commonjs"` Node reads a plain `.ts` file as CommonJS, and
|
|
46
|
+
nukadoko is ESM-only. `nuka init` already wrote a matching
|
|
47
|
+
`nukadoko.config.mts` in that case.
|
|
48
|
+
|
|
49
|
+
Node runs a step file by erasing its types, so write TypeScript that
|
|
50
|
+
erases cleanly. Import another step file by its own name, `.ts` included
|
|
51
|
+
(`import openAccount from "./open-account.ts"`), the spelling `nuka
|
|
52
|
+
scaffold --from` writes. When `tsconfig.json` sets neither
|
|
53
|
+
`rewriteRelativeImportExtensions` nor `allowImportingTsExtensions`,
|
|
54
|
+
scaffold writes `./open-account.js` and a `note:` line instead; `nuka`
|
|
55
|
+
loads the `.ts` file under that name, so keep it. Import a type with
|
|
56
|
+
`import type`: a type imported without it fails with "does not provide an
|
|
57
|
+
export named". An `enum`, a `namespace`, or a constructor parameter
|
|
58
|
+
property does not load; `nuka check` reports `step-file-import-failed` at
|
|
59
|
+
its line. Write an object with `as const` and a field assigned in the
|
|
60
|
+
constructor instead.
|
|
61
|
+
|
|
62
|
+
## The fixtures a step names
|
|
63
|
+
|
|
64
|
+
`run`'s first argument, and `observe`'s, is an object destructuring
|
|
65
|
+
pattern, every time: nukadoko reads which fixtures to build from its
|
|
66
|
+
source text without calling `run`. A step needing no fixtures writes
|
|
67
|
+
`run({}, args)`, and one needing neither writes `run()`. `run({ sum })`
|
|
68
|
+
reads `sum` as a fixture; when `sum` is an args key, `nuka check` says so
|
|
69
|
+
and names `run({}, { sum })`. Any other parameter, `_ctx` included, is
|
|
70
|
+
refused. A fixture the project declares in `nukadoko.config.ts` also
|
|
71
|
+
needs a `StepFixtures` declaration before `tsc` accepts a step that
|
|
72
|
+
destructures it (`fixtures.md`). `page`, `context`, and `request` are
|
|
73
|
+
Playwright's own objects, so reach for Playwright's documentation for
|
|
74
|
+
what to call on them.
|
|
75
|
+
|
|
76
|
+
## The deadline
|
|
77
|
+
|
|
78
|
+
A step's `run` has a deadline: `stepTimeout` in `nukadoko.config.ts`,
|
|
79
|
+
twenty minutes unless the project sets it. A step that waits longer by
|
|
80
|
+
design declares its own `timeout` in milliseconds on `defineStep`. There
|
|
81
|
+
is no value meaning "no limit". `nuka steps` and `nuka describe` show a
|
|
82
|
+
declared `timeout`. Any other key on `defineStep` (a leftover
|
|
83
|
+
`rationale`, a misspelling) does nothing, and `nuka check` warns
|
|
84
|
+
`step-option-ignored`.
|
|
85
|
+
|
|
86
|
+
## Parameter types
|
|
87
|
+
|
|
88
|
+
`parameterTypes` in `nukadoko.config.ts` takes a
|
|
89
|
+
`{ name, regexp, transformer? }` entry per type: a `negation` type
|
|
90
|
+
matching an optional `" not"` and turning it into a boolean lets a pattern
|
|
91
|
+
write `will{negated:negation} return` straight into a `z.boolean()` args
|
|
92
|
+
key. `transformer` only coerces the matched text; it runs with the
|
|
93
|
+
scenario's World as `this`, and a Promise it returns is awaited. A schema
|
|
94
|
+
that coerces (`z.coerce.number()` for a `{string}`) keeps
|
|
95
|
+
`capture-type-mismatch` quiet, because the run accepts that capture. A
|
|
96
|
+
record stores a bigint as its decimal string, and `nuka do --args` takes
|
|
97
|
+
a `z.bigint()` field the same way (`{"count":"123"}`).
|
|
98
|
+
|
|
99
|
+
## Several people in one scenario
|
|
100
|
+
|
|
101
|
+
`await pageAs(name, { javaScriptEnabled: false })` returns Playwright's
|
|
102
|
+
`Page` in a browser context of that person's own, so each keeps their own
|
|
103
|
+
cookies. Take the name from the feature line, lowercased
|
|
104
|
+
(`pageAs(name.toLowerCase())`).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Reading the verdict table
|
|
2
2
|
|
|
3
3
|
A run ends in one table, run.json's `table`, and the run summary opens
|
|
4
|
-
with it: one row per criterion, one column per
|
|
4
|
+
with it: one row per criterion, one column per system and environment
|
|
5
5
|
(`head <environment>`, then the conditions it declares, and under
|
|
6
6
|
`--base` also `base <environment>` and `old <environment>`), and one
|
|
7
7
|
verdict per row, which the exit code follows. Under the table, each red
|
|
@@ -32,7 +32,7 @@ a scenario no named environment meets is not run, and the summary's
|
|
|
32
32
|
`left-out` entry counts it (`<n> criteria not run`). A control never turns the run red. Tag only what the criteria say depends
|
|
33
33
|
on the switch, and write the Then so it would fail on the other side: a
|
|
34
34
|
When that errors there proves nothing. A time zone, a clock, or a seed no criterion
|
|
35
|
-
may depend on gets environments and no tag (`references/perturbed-
|
|
35
|
+
may depend on gets environments and no tag (`references/perturbed-systems.md`).
|
|
36
36
|
|
|
37
37
|
When the program writes `flag` lines to `{events}` (`references/program.md`),
|
|
38
38
|
run.json's `flags` has one row per flag and side the head steps' lines named
|
|
@@ -61,7 +61,7 @@ criteria that sent them. A request is not a check: a Given's counts as a
|
|
|
61
61
|
Then's, so a route with requests may still be one no claim reads. The
|
|
62
62
|
summary's "Routes" names the listed routes no step requested, apart from
|
|
63
63
|
a PATCH whose handler a PUT reached, and the requests no list names. A
|
|
64
|
-
|
|
64
|
+
system whose list was not read gives no `routes` and a
|
|
65
65
|
`program-list-unread` warning: fix the command before reading a gap.
|
|
66
66
|
With a flags list, `flags` has a row for every side it declares, with
|
|
67
67
|
no `criteria` for a side no criterion evaluated, and `listed_in`;
|
|
@@ -80,13 +80,13 @@ table, a docstring, an Examples row, a condition tag, or an `@expects:` tag), `n
|
|
|
80
80
|
mapping did: a step file or helper under the features directory, the
|
|
81
81
|
config's fixtures or parameter types, an environment's conditions.
|
|
82
82
|
|
|
83
|
-
- A `new` or `changed` row also runs in the `base`
|
|
83
|
+
- A `new` or `changed` row also runs in the `base` system, the base's
|
|
84
84
|
code under your criteria and steps. Its Then has to fail there, at one
|
|
85
85
|
line in each of `--proof-runs` runs, for the row to be `proven`. Write
|
|
86
86
|
the Then so it fails without the change: a When that errors there
|
|
87
87
|
proves nothing.
|
|
88
88
|
- An `unchanged` row, when the mapping changed, its tags did
|
|
89
|
-
(`retagged`), or its name or file did (`renamed_from`), also runs in the `old`
|
|
89
|
+
(`retagged`), or its name or file did (`renamed_from`), also runs in the `old` system, your code under the base's feature file, steps, and conditions, and has to
|
|
90
90
|
pass there. A rewritten step that now checks less is what this catches.
|
|
91
91
|
- When both programs name `{events}`, the base also runs every row
|
|
92
92
|
head ran, once, for run.json's `paths` alone (`for_paths`, `(for paths)`
|
|
@@ -94,7 +94,7 @@ config's fixtures or parameter types, an environment's conditions.
|
|
|
94
94
|
base with its head, step by step: "Changed paths" lists under
|
|
95
95
|
`base → head` what the program does differently at head, the criteria
|
|
96
96
|
that did not change included, a refactor's too: head's `{events}` alone
|
|
97
|
-
builds the base
|
|
97
|
+
builds the base system. A changed criterion there has `explained_by`:
|
|
98
98
|
`intent` when rows of the change's `INTENT.md` declare every difference
|
|
99
99
|
(`references/done.md`), `criterion_change` when its sentences are new
|
|
100
100
|
or changed, and `null` otherwise; the summary lists the `null` ones
|
|
@@ -124,7 +124,7 @@ the reason and a `proof-run-incomplete` warning: the row reads as one
|
|
|
124
124
|
no control proves (under `--base`, its base cell decides), so correct
|
|
125
125
|
the hook. A `broke` cell whose reason says a claim was judged before every
|
|
126
126
|
execution event it counts had arrived (`claim-judged-early`) was judged on
|
|
127
|
-
lines still on their way (its `
|
|
127
|
+
lines still on their way (its `after_system_stop` has the whole count): have
|
|
128
128
|
the program write a request's line after the work inside it, and work that
|
|
129
129
|
outlives the request as a job (docs/execution-events.md "Inside first").
|
|
130
130
|
|
|
@@ -159,7 +159,7 @@ nothing; `nuka check` reports `expects-tag-malformed` and `expects-unread`.
|
|
|
159
159
|
nothing either: a Given or When failed where the behaviour is absent,
|
|
160
160
|
before any Then was judged. Under `--base`, an `unchanged` row no
|
|
161
161
|
control proves is `held` when the mapping did not change or the old
|
|
162
|
-
|
|
162
|
+
system passed it, and a `@held` row when the base passed it.
|
|
163
163
|
- **`unproven`** (red): a `new` or `changed` row passed, and nothing
|
|
164
164
|
shows its Then failing without the change: the base passed it, broke
|
|
165
165
|
before a Then, or did not run. When the base already had the behaviour
|
|
@@ -171,7 +171,7 @@ nothing; `nuka check` reports `expects-tag-malformed` and `expects-unread`.
|
|
|
171
171
|
meant. Read the reason: a step that now checks something else is a
|
|
172
172
|
change to report to the person; a reason that says the base's steps
|
|
173
173
|
did not load (a module of the program they import moved) means the
|
|
174
|
-
refactor broke the old steps, and docs/upgrading.md in the package says
|
|
174
|
+
refactor broke the old steps, and docs/typescript/upgrading.md in the package says
|
|
175
175
|
how to land one.
|
|
176
176
|
- **`removed`**: the base had the criterion and you dropped it. The
|
|
177
177
|
summary quotes it under "Removed criteria" so the person sees it went.
|
|
@@ -181,7 +181,7 @@ Each `unproven` and `moved` row is also a `criterion-unproven` or
|
|
|
181
181
|
same base by its commit hash, which holds after you commit or the base moves.
|
|
182
182
|
A reason that says `--base` does not support a shape yet (a symbolic link, a
|
|
183
183
|
feature file outside the features directory, a workspace package, a
|
|
184
|
-
submodule) means that
|
|
184
|
+
submodule) means that system was not built: make the `fix:` edit, or run the
|
|
185
185
|
`do:` line, which leaves `--base` off, and tell the person the row was not
|
|
186
186
|
judged against the base.
|
|
187
187
|
|
|
@@ -7,10 +7,10 @@ file's shape and its pattern: `step-files.md`. A Then, which claims:
|
|
|
7
7
|
|
|
8
8
|
## Reading the vocabulary
|
|
9
9
|
|
|
10
|
-
`nuka steps --json` lists the
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
`nuka steps --json` lists the vocabulary, `nuka steps <feature>[:<line>]`
|
|
11
|
+
only the steps those lines bind (each with `lines`) and their `parts`, and
|
|
12
|
+
`nuka describe <step>` one full contract. Both name any step file that
|
|
13
|
+
failed to import, and `nuka check` is where to fix the import.
|
|
14
14
|
When a step's args or returns schema cannot be represented as JSON
|
|
15
15
|
Schema (a `z.date()`, say), `nuka describe` still prints that step's
|
|
16
16
|
contract with `args_error` or `returns_error` naming the step, and exits
|
|
@@ -39,70 +39,70 @@ producer's `returns`, and a producer that is still a stub declares none:
|
|
|
39
39
|
key to chain`. So write each Given's `returns` first, then the When that
|
|
40
40
|
reads from it, then the Thens that read from the When.
|
|
41
41
|
|
|
42
|
-
When the feature already holds the lines, `nuka scaffold --feature
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
`{value:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
names listed: a number is
|
|
62
|
-
`{key:number}`. A pattern that is not a
|
|
63
|
-
refused too ("Writing the pattern" in
|
|
64
|
-
Add `--then` for a step a Then line binds: it writes a
|
|
65
|
-
`claims` in place of `run`, with no `returns` and no `mutates`.
|
|
66
|
-
one value the line states and one `--from`, the claim compares the two
|
|
67
|
-
with `equal` (`view: "text"` for `stdout` or `stderr`); otherwise it
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
`
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
`--argv <key>` splits one on whitespace only (`"input.csv --json"`),
|
|
42
|
+
When the feature already holds the lines, `nuka scaffold --feature <file>`
|
|
43
|
+
(the `do:` line of the `undefined-step` finding, with the file filled in)
|
|
44
|
+
writes one stub for each line `nuka check <file>` calls undefined, with the
|
|
45
|
+
pattern read from the line: a quoted value is `{value:string}`, an integer
|
|
46
|
+
`{value:int}`, a decimal `{value:float}`, and a Then line gets a claim step:
|
|
47
|
+
an `observe` that throws under a TODO and a claim on the `actual` it returns.
|
|
48
|
+
Return the observed value, or take it through `from` and drop `observe`.
|
|
49
|
+
Rename `value`, `value2` to what the values mean, in the pattern and in `args`
|
|
50
|
+
together. A `note:` line on stderr names each line whose reading was not the
|
|
51
|
+
only one, or would match a line a step binds, one that reads another way, or
|
|
52
|
+
one elsewhere that differs in being a Then or in its docstring or table: its
|
|
53
|
+
pattern is the line as written, so add the captures by hand, and such a Then
|
|
54
|
+
line gets no stub (scaffold it alone, `--then` and a capture in `--pattern`).
|
|
55
|
+
A `next:` block on stderr gives each stub's own scaffold with `--replace`; add
|
|
56
|
+
`--command` or `--from` to it (`--replace` refuses an edited file).
|
|
57
|
+
|
|
58
|
+
1. `nuka scaffold <name> --pattern "<feature line>"`, kebab-case, one file per
|
|
59
|
+
step. Each `{key:type}` capture becomes an args field, so the file passes
|
|
60
|
+
`nuka check` against that line before `run` is written. A type the project
|
|
61
|
+
does not register is refused with the registered names listed: a number is
|
|
62
|
+
`{key:int}` or `{key:float}`, not `{key:number}`. A pattern that is not a
|
|
63
|
+
valid Cucumber Expression is refused too ("Writing the pattern" in
|
|
64
|
+
`step-files.md`). Add `--then` for a step a Then line binds: it writes a
|
|
65
|
+
claim step, `claims` in place of `run`, with no `returns` and no `mutates`.
|
|
66
|
+
With one value the line states and one `--from`, the claim compares the two
|
|
67
|
+
with `equal` (`view: "text"` for `stdout` or `stderr`); otherwise it writes
|
|
68
|
+
an `observe` stub. It refuses a line that states no value, two values of
|
|
69
|
+
two JSON types, and a claim that leaves a stated value unread. A step whose
|
|
70
|
+
feature lines carry a docstring or a table gets a `docstring` or `table`
|
|
71
|
+
key, which a Then claims like a capture; write the feature line first, or
|
|
72
|
+
add the key by hand, or `nuka check` reports
|
|
73
|
+
`table-docstring-key-mismatch`. Add `--from <step>.<key>` for each value
|
|
74
|
+
the step reads from an earlier step's result: it writes the import, the
|
|
75
|
+
args field, and the `from` entry ("Chaining a value from an earlier step").
|
|
76
|
+
Repeat it with the same key for a key that either of two producers fills
|
|
77
|
+
(`--from a.dir --from b.dir`); their schemas for the key must match. Add
|
|
78
|
+
`--command <entry point>` for a When step that runs a program (`--command
|
|
79
|
+
src/cli.ts`, relative to the directory `nuka` runs in or absolute, and
|
|
80
|
+
refused unless a file is there): it writes the entry point resolved against
|
|
81
|
+
that directory (`resolve`, `File.expand_path`), a run of it in an empty
|
|
82
|
+
scratch directory, and `returns` of `exitCode`,
|
|
83
|
+
`stdout`, and `stderr`. A file a Given wrote is in the directory it
|
|
84
|
+
returned: `--from <given>.dir --cwd dir` runs the program there
|
|
85
|
+
(`typescript/examples/cli.md`, `ruby/examples/cli.md`). Only captures are
|
|
86
|
+
argv; `--argv <key>` splits one on whitespace only (`"input.csv --json"`),
|
|
87
87
|
and any other `--from` value throws by name until you pass it (`env`).
|
|
88
|
-
|
|
88
|
+
TypeScript runs the entry point under plain `node`: when `.ts` files import
|
|
89
89
|
each other as `./x.js`, name the built program (`dist/cli.js`, with
|
|
90
|
-
`"pretest:scenarios": "npm run build"`).
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
in the path is that args key's
|
|
96
|
-
<key>` sends one as the data (`--body
|
|
97
|
-
throws by name until you pass it. Quote a
|
|
98
|
-
(`When I request "/health"`) so `--feature` reads
|
|
99
|
-
`--command` and `--request` write `mutates: true`, because
|
|
100
|
-
cannot know what the call writes; set it to `false`, with a
|
|
101
|
-
that says why, when it writes nothing a later scenario could read.
|
|
90
|
+
`"pretest:scenarios": "npm run build"`). Ruby runs it under
|
|
91
|
+
`RbConfig.ruby`: put the program's interpreter there for another language,
|
|
92
|
+
and add `unbundled: true` for a program in another Ruby project. Add
|
|
93
|
+
`--request "<METHOD> <path>"` for a When step that calls an HTTP API: one
|
|
94
|
+
request on the `request` fixture, against the system's URL, returning
|
|
95
|
+
`status` and `body` (the text). A `{key}` in the path is that args key's
|
|
96
|
+
value (`"GET /items/{id}"`), `--body <key>` sends one as the data (`--body
|
|
97
|
+
docstring`), and any other value throws by name until you pass it. Quote a
|
|
98
|
+
path in the feature line (`When I request "/health"`) so `--feature` reads
|
|
99
|
+
it as a value. `--command` and `--request` write `mutates: true`, because
|
|
100
|
+
scaffold cannot know what the call writes; set it to `false`, with a
|
|
101
|
+
comment that says why, when it writes nothing a later scenario could read.
|
|
102
102
|
Add `--description "<text>"` for what the step does. Without it,
|
|
103
|
-
`--command` and `--request` write a description of what they generate;
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
`--command` and `--request` write a description of what they generate; any
|
|
104
|
+
other form writes `TODO: describe <name>`, which `nuka check` notes as
|
|
105
|
+
`step-description-todo`. A step reached by name only needs no `--pattern`.
|
|
106
106
|
2. Implement it. The shape of that file is in `step-files.md`.
|
|
107
107
|
3. `nuka do <step> --args '<json>'`, exercise it alone, check the step
|
|
108
108
|
record, before it ever touches a feature. Fix and re-run until it does
|
|
@@ -127,7 +127,7 @@ the project (a real service, a shared database, a file outside
|
|
|
127
127
|
go-ahead, once per step, not on every retry while fixing it, or
|
|
128
128
|
trial-and-error stops being possible. A step that writes only under
|
|
129
129
|
`scratch`, or to a server a fixture or the program in `nukadoko.config.ts` started, needs no
|
|
130
|
-
go-ahead (`examples/http-api.md`), nor does a claim or `mutates: false` step.
|
|
130
|
+
go-ahead (`typescript/examples/http-api.md`), nor does a claim or `mutates: false` step.
|
|
131
131
|
|
|
132
132
|
With nobody to ask mid-task, because the caller handed the task over
|
|
133
133
|
rather than sitting in the conversation, the go-ahead has to exist before
|
|
@@ -191,7 +191,7 @@ step read both.
|
|
|
191
191
|
|
|
192
192
|
When the same producer runs more than once in a scenario, `from` reads
|
|
193
193
|
its most recent result: two registrations followed by "the confirmation
|
|
194
|
-
link is opened" confirm the second one (`examples/workflow.md`).
|
|
194
|
+
link is opened" confirm the second one (`typescript/examples/workflow.md`).
|
|
195
195
|
|
|
196
196
|
Declaring `from` is not just documentation: `nuka check` reads it and
|
|
197
197
|
verifies the producing step actually appears earlier in the same scenario,
|
|
@@ -108,7 +108,7 @@ rather than an instruction to the tool. The same step can be the When of
|
|
|
108
108
|
one scenario and a Given of another: a registration is the action under
|
|
109
109
|
test in "a short password" and the setup in "sign in before confirming".
|
|
110
110
|
A step that can be refused returns the outcome instead of throwing, so a
|
|
111
|
-
Then can claim the refusal (`examples/workflow.md`).
|
|
111
|
+
Then can claim the refusal (`typescript/examples/workflow.md`).
|
|
112
112
|
|
|
113
113
|
The keyword meets a step's contract in one place: a Then binds a claim
|
|
114
114
|
step, and only a Then does. A Then bound to a step that runs is the
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: nukadoko-verification
|
|
3
3
|
description: Use when a project has, or is getting, a verification skill (a control CLI that drives the running app, plus a feature map of what the app does and how a user reaches it) and its claims need evidence that can be run again; when a bug report has to be reproduced before it is fixed; or when prototypes or the steps of a plan need one yardstick fixed before they are built. Adds nukadoko scenarios as the proof layer under the map. It does not replace the control CLI or the map.
|
|
4
|
-
compatibility: Requires
|
|
4
|
+
compatibility: Requires nukadoko installed in the project, the npm package (run as `npx nuka`) or the gem (run as `bundle exec nuka`); `nuka` below is that launcher. Works beside a verification skill generated by pstack's create-verification-skill, or a hand-written one with launch, doctor, drive, evidence, and cleanup sections.
|
|
5
5
|
license: MIT
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -122,7 +122,7 @@ only values loaded from env files or named in `redact` are redacted, so
|
|
|
122
122
|
pass a token through `env`, never as an argument. The record names every
|
|
123
123
|
variable in `env` but shows a value only when it is an absolute path that
|
|
124
124
|
exists, a decimal integer, or `true` or `false`. When the run has a
|
|
125
|
-
|
|
125
|
+
system, the process also gets `TRACEPARENT`, the step's trace context
|
|
126
126
|
(its entry's `traceparent`), unless the step set its own: a tool that
|
|
127
127
|
copies it into the `traceparent` header of its requests makes the
|
|
128
128
|
program's log lines and execution events for them the step's.
|
|
@@ -145,7 +145,7 @@ and `nuka clean` removes all of them. Evidence for a pull request leaves
|
|
|
145
145
|
the run directory:
|
|
146
146
|
|
|
147
147
|
```sh
|
|
148
|
-
|
|
148
|
+
nuka report "$(nuka run --json | jq -r .run_dir)" --format markdown --out <evidence dir>/summary.md
|
|
149
149
|
```
|
|
150
150
|
|
|
151
151
|
`run_dir` in run.json is the run directory; `environments[].base_url`
|
|
@@ -194,18 +194,23 @@ has run.
|
|
|
194
194
|
|
|
195
195
|
When the scenario and the program live in the product's repository,
|
|
196
196
|
`nuka run --base <the commit before the fix>` shows red before and green
|
|
197
|
-
after in one run: the base
|
|
197
|
+
after in one run: the base system builds the base's code from its program
|
|
198
198
|
file. When the scenario lives outside the product's repository, `--base`
|
|
199
199
|
compares the scenario project's commits, not the product's, so showing
|
|
200
200
|
both takes two checkouts: put the commit before the fix and the fix commit
|
|
201
201
|
in separate worktrees and run the same scenario against each. The run's
|
|
202
|
-
`commit` is then the scenario project's
|
|
203
|
-
|
|
204
|
-
|
|
202
|
+
`commit` is then the scenario project's. A program whose service names the
|
|
203
|
+
product's clone as its `root` binds the evidence to the product by itself:
|
|
204
|
+
run.json and the summary name the commit that clone had checked out, and
|
|
205
|
+
`with uncommitted changes` when it was dirty
|
|
206
|
+
(`skills/nukadoko/references/program.md`, "Several services"). For a
|
|
207
|
+
product the run reaches at a `url`, return the product's
|
|
208
|
+
`git rev-parse HEAD` from the environment's `version` probe, which the
|
|
209
|
+
summary shows as the target version.
|
|
205
210
|
|
|
206
211
|
When the fix sits behind a switch the program reads (a flag, a setting),
|
|
207
212
|
one run shows both sides instead: declare the switch in `conditions` on
|
|
208
|
-
two environments of the program in
|
|
213
|
+
two environments of the program in the config and tag the scenario
|
|
209
214
|
`@with:<switch>`, so the side without the fix is a control. The verdict
|
|
210
215
|
table reads `proven` when the Then breaks there at the same line in each
|
|
211
216
|
of `--proof-runs` runs, and `held` when it passes there, which says what
|