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,563 @@
|
|
|
1
|
+
# Writing scenarios and steps
|
|
2
|
+
|
|
3
|
+
This page shows how to write a feature file and the steps behind it. It is
|
|
4
|
+
for a person who writes both by hand, in either engine. Two small projects
|
|
5
|
+
run through the page, and CI runs both in both engines:
|
|
6
|
+
|
|
7
|
+
- **todo**: an HTTP API that adds, lists, and completes todos. It shows
|
|
8
|
+
captures, a table, and a Then that reads the server.
|
|
9
|
+
- **tally**: a command line program that sums a CSV file per category. It
|
|
10
|
+
shows doc strings, temporary directories, and values that pass from one
|
|
11
|
+
step to the next.
|
|
12
|
+
|
|
13
|
+
Each code example is a pair: the Ruby step first, then the TypeScript step.
|
|
14
|
+
The two steps do the same thing. Prose writes the command as `nuka`. Your
|
|
15
|
+
project runs it through its own launcher:
|
|
16
|
+
|
|
17
|
+
<!-- engine: ruby -->
|
|
18
|
+
```sh
|
|
19
|
+
bundle exec nuka check
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
<!-- engine: typescript -->
|
|
23
|
+
```sh
|
|
24
|
+
npx nuka check
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## One behavior per scenario, in the asker's words
|
|
28
|
+
|
|
29
|
+
A feature file holds the acceptance criteria of one feature. Write the
|
|
30
|
+
criteria under `Feature:` as the person who asked for them wrote them.
|
|
31
|
+
Then write one scenario for each behavior, in words that this person can
|
|
32
|
+
read:
|
|
33
|
+
|
|
34
|
+
```gherkin
|
|
35
|
+
Feature: tally sums amounts per category
|
|
36
|
+
|
|
37
|
+
Acceptance criteria (from the request):
|
|
38
|
+
- Given a CSV of category,amount lines, tally prints one "category: total" line per category, sorted by name
|
|
39
|
+
- --json prints the same totals as one JSON object
|
|
40
|
+
- A file that cannot be read is an error with exit code 2
|
|
41
|
+
- A line that is not category,amount is an error with exit code 3
|
|
42
|
+
|
|
43
|
+
Scenario: a file that cannot be read
|
|
44
|
+
Given an empty directory
|
|
45
|
+
When I run tally with "missing.csv"
|
|
46
|
+
Then it exits with 2
|
|
47
|
+
And the error says "tally: cannot read missing.csv"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Follow these rules, so that a scenario fails only for the right reason:
|
|
51
|
+
|
|
52
|
+
- **Write the sentence about what a user sees.** `When I run tally with
|
|
53
|
+
"missing.csv"` names what a user does with the program, not how the
|
|
54
|
+
program works inside. A sentence about a handler, a
|
|
55
|
+
table, or a variable names the implementation, and it changes when the
|
|
56
|
+
implementation changes.
|
|
57
|
+
- **Put every value in the line.** The file name, the exit code, and the
|
|
58
|
+
message are in the scenario, so a reviewer sees each value that the
|
|
59
|
+
scenario depends on. A value that hides in step code is a value nobody
|
|
60
|
+
reviews.
|
|
61
|
+
- **Take the expected value from the criteria, not from a run.** Do not
|
|
62
|
+
run the program and paste what it printed. When the criteria give no
|
|
63
|
+
example, ask the person before you write one.
|
|
64
|
+
- **Give a negative path its own scenario.** "A file that cannot be read"
|
|
65
|
+
is a scenario of its own, and its Then states the exact message.
|
|
66
|
+
- **Start each scenario from nothing.** All scenarios of a run talk to
|
|
67
|
+
the same program. A scenario that reads a todo creates that todo
|
|
68
|
+
itself.
|
|
69
|
+
- **Write one claim per Then line.** `Then it exits with 2` and `And the
|
|
70
|
+
error says ...` are two lines, so a failure names one of them.
|
|
71
|
+
|
|
72
|
+
A Scenario Outline runs once for each row of its `Examples` table. Put a
|
|
73
|
+
column in its name (`Scenario Outline: greets <name>`), so each row has its
|
|
74
|
+
own name in the [run summary](spec.md#records). A Background holds the
|
|
75
|
+
Givens that every scenario of the file shares, and nothing else.
|
|
76
|
+
|
|
77
|
+
## Given, When, and Then
|
|
78
|
+
|
|
79
|
+
The keyword tells the reader what the line does:
|
|
80
|
+
|
|
81
|
+
- **Given** sets up what is already true.
|
|
82
|
+
- **When** is the action under test.
|
|
83
|
+
- **Then** states what a person can see after the action.
|
|
84
|
+
|
|
85
|
+
The system is the program under test and everything that it holds, such
|
|
86
|
+
as its data and its files. A Given or a When step has a `run` body. The
|
|
87
|
+
body acts on the system. It returns values that a later step can read.
|
|
88
|
+
|
|
89
|
+
A Then step has no `run`. It declares **claims**. A claim names the value
|
|
90
|
+
to read, the comparison, and the source of the expected value. nukadoko
|
|
91
|
+
compares the two values. To read the system, a Then step declares an
|
|
92
|
+
`observe` body. This body returns the values that the claims read. A Then
|
|
93
|
+
step runs no assertion of its own.
|
|
94
|
+
|
|
95
|
+
This When step completes a todo, and returns the todo as the server
|
|
96
|
+
answered:
|
|
97
|
+
|
|
98
|
+
```ruby
|
|
99
|
+
class CompleteTodo < Nukadoko::Step
|
|
100
|
+
pattern "the todo titled {title:string} is completed"
|
|
101
|
+
description "Find a todo by title and PATCH it to done: true"
|
|
102
|
+
args { string :title, "The title of the todo to complete; must already exist" }
|
|
103
|
+
returns do
|
|
104
|
+
string :id, "The id of the todo that was completed"
|
|
105
|
+
string :title, "Its title, as the server returned it"
|
|
106
|
+
boolean :done, "true after the PATCH"
|
|
107
|
+
end
|
|
108
|
+
mutates true
|
|
109
|
+
|
|
110
|
+
def run(request:, args:)
|
|
111
|
+
match = request.get("/todos").json.find { _1["title"] == args.title }
|
|
112
|
+
raise %(no todo titled "#{args.title}" to complete) unless match
|
|
113
|
+
|
|
114
|
+
request.patch("/todos/#{match["id"]}", data: { done: true }).json
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
import { defineStep, z } from "nukadoko";
|
|
121
|
+
|
|
122
|
+
export default defineStep({
|
|
123
|
+
pattern: "the todo titled {title:string} is completed",
|
|
124
|
+
description: "Find a todo by title and PATCH it to done: true",
|
|
125
|
+
args: z.object({ title: z.string().describe("The title of the todo to complete; must already exist") }),
|
|
126
|
+
returns: z.object({
|
|
127
|
+
id: z.string().describe("The id of the todo that was completed"),
|
|
128
|
+
title: z.string().describe("Its title, as the server returned it"),
|
|
129
|
+
done: z.boolean().describe("true after the PATCH"),
|
|
130
|
+
}),
|
|
131
|
+
mutates: true,
|
|
132
|
+
async run({ request }, args) {
|
|
133
|
+
const listRes = await request.get("/todos");
|
|
134
|
+
const todos = (await listRes.json()) as Array<{ id?: string; title?: string }>;
|
|
135
|
+
const match = todos.find((todo) => todo.title === args.title);
|
|
136
|
+
if (!match) {
|
|
137
|
+
throw new Error(`no todo titled "${args.title}" to complete`);
|
|
138
|
+
}
|
|
139
|
+
const res = await request.patch(`/todos/${match.id}`, { data: { done: true } });
|
|
140
|
+
return res.json();
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
This Then step reads the list of titles, and claims that the title from the
|
|
146
|
+
line is one of them:
|
|
147
|
+
|
|
148
|
+
```ruby
|
|
149
|
+
class TodoListIncludes < Nukadoko::Step
|
|
150
|
+
pattern "the todo list includes {title:string}"
|
|
151
|
+
description "A todo with this title is present in GET /todos"
|
|
152
|
+
args { string :title, "The title expected to be present" }
|
|
153
|
+
claims [{ actual: "titles", compare: "has-item", expected: "title" }]
|
|
154
|
+
|
|
155
|
+
def observe(request:, args:)
|
|
156
|
+
{ titles: request.get("/todos").json.map { _1["title"] } }
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
```ts
|
|
162
|
+
import { defineStep, z } from "nukadoko";
|
|
163
|
+
|
|
164
|
+
export default defineStep({
|
|
165
|
+
pattern: "the todo list includes {title:string}",
|
|
166
|
+
description: "A todo with this title is present in GET /todos",
|
|
167
|
+
args: z.object({ title: z.string().describe("The title expected to be present") }),
|
|
168
|
+
async observe({ request }) {
|
|
169
|
+
const res = await request.get("/todos");
|
|
170
|
+
const todos = (await res.json()) as Array<{ title?: string }>;
|
|
171
|
+
return { titles: todos.map((todo) => todo.title) };
|
|
172
|
+
},
|
|
173
|
+
claims: [{ actual: "titles", compare: "has-item", expected: "title" }],
|
|
174
|
+
});
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
A line matches a step by its pattern. Only a Then line binds a step with
|
|
178
|
+
claims. The full rules are in [Keyword semantics](spec.md#keyword-semantics)
|
|
179
|
+
in the spec, and [nuka check](commands.md#nuka-check) shows the finding
|
|
180
|
+
for a line in the wrong position.
|
|
181
|
+
|
|
182
|
+
Some actions can be refused, for example a registration with a short
|
|
183
|
+
password. A Given or a When for such an action returns the outcome and
|
|
184
|
+
does not raise. A Then line can then claim the refusal and its reason.
|
|
185
|
+
The sign-up project in
|
|
186
|
+
[conformance/cases/workflow](https://github.com/meganemura/nukadoko/tree/main/conformance/cases/workflow) does this.
|
|
187
|
+
|
|
188
|
+
## Captures, tables, and doc strings
|
|
189
|
+
|
|
190
|
+
A line gives values to its step in three ways.
|
|
191
|
+
|
|
192
|
+
**A capture** is a `{key:type}` part of the pattern. It fills the args key
|
|
193
|
+
`key`. `{title:string}` matches a value in double or single quotes, and
|
|
194
|
+
the quotes are not part of the value. `{code:int}` matches a whole number, as in `it
|
|
195
|
+
exits with {code:int}`. `{state:word}` matches one word with no quotes. An
|
|
196
|
+
unnamed `{string}` is refused: every capture names its key.
|
|
197
|
+
|
|
198
|
+
**A data table** under the line fills the one args key that no capture
|
|
199
|
+
and no `from` fills, as a list of rows. (`from` carries a value from an
|
|
200
|
+
earlier step. See
|
|
201
|
+
[Passing values between steps](#passing-values-between-steps).) Each row
|
|
202
|
+
is a list of cells:
|
|
203
|
+
|
|
204
|
+
```gherkin
|
|
205
|
+
Scenario: Adding several todos at once
|
|
206
|
+
Given the following todos are added
|
|
207
|
+
| Water the plants |
|
|
208
|
+
| Read a book |
|
|
209
|
+
Then the todo list includes "Water the plants"
|
|
210
|
+
And the todo list includes "Read a book"
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
```ruby
|
|
214
|
+
class AddTodosFromTable < Nukadoko::Step
|
|
215
|
+
pattern "the following todos are added"
|
|
216
|
+
description "POST /todos once per table row and return the titles created"
|
|
217
|
+
args { table :todos, "The data table's rows, one todo per row, the title in the first cell" }
|
|
218
|
+
returns { strings :created, "The titles the server stored, in row order" }
|
|
219
|
+
mutates true
|
|
220
|
+
|
|
221
|
+
def run(request:, args:)
|
|
222
|
+
{ created: args.todos.map { |row| request.post("/todos", data: { title: row.first }).json["title"] } }
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
```ts
|
|
228
|
+
import { defineStep, z } from "nukadoko";
|
|
229
|
+
|
|
230
|
+
export default defineStep({
|
|
231
|
+
pattern: "the following todos are added",
|
|
232
|
+
description: "POST /todos once per table row and return the titles created",
|
|
233
|
+
args: z.object({
|
|
234
|
+
todos: z
|
|
235
|
+
.array(z.array(z.string()))
|
|
236
|
+
.describe("The data table's rows, one todo per row, the title in the first cell"),
|
|
237
|
+
}),
|
|
238
|
+
returns: z.object({ created: z.array(z.string()).describe("The titles the server stored, in row order") }),
|
|
239
|
+
mutates: true,
|
|
240
|
+
async run({ request }, args) {
|
|
241
|
+
const created: string[] = [];
|
|
242
|
+
for (const row of args.todos) {
|
|
243
|
+
const res = await request.post("/todos", { data: { title: row[0] } });
|
|
244
|
+
const todo = (await res.json()) as { title?: string };
|
|
245
|
+
created.push(todo.title as string);
|
|
246
|
+
}
|
|
247
|
+
return { created };
|
|
248
|
+
},
|
|
249
|
+
});
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**A doc string** is text between two `"""` lines under the line. It fills
|
|
253
|
+
the one args key that no capture and no `from` fills, as one string. The tally Given
|
|
254
|
+
writes the doc string to a file:
|
|
255
|
+
|
|
256
|
+
```gherkin
|
|
257
|
+
Given a file "input.csv" with these lines
|
|
258
|
+
"""
|
|
259
|
+
rent,100
|
|
260
|
+
food,3
|
|
261
|
+
food,2.5
|
|
262
|
+
"""
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
The step captures `name`, so the doc string fills `lines`. This is the
|
|
266
|
+
pattern, the args, and the body of the step (its `returns` gives `dir` and
|
|
267
|
+
`bytes`):
|
|
268
|
+
|
|
269
|
+
```ruby
|
|
270
|
+
pattern "a file {name:string} with these lines"
|
|
271
|
+
args do
|
|
272
|
+
string :name, "The file name, relative to the scratch directory"
|
|
273
|
+
string :lines, "The file's contents, verbatim"
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
def run(scratch:, args:)
|
|
277
|
+
dir = scratch.dir
|
|
278
|
+
body = args.lines.end_with?("\n") ? args.lines : "#{args.lines}\n"
|
|
279
|
+
File.write(File.join(dir, args.name), body)
|
|
280
|
+
{ dir: dir, bytes: body.bytesize }
|
|
281
|
+
end
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
```ts
|
|
285
|
+
pattern: "a file {name:string} with these lines",
|
|
286
|
+
args: z.object({
|
|
287
|
+
name: z.string().describe("The file name, relative to the scratch directory"),
|
|
288
|
+
lines: z.string().describe("The file's contents, verbatim"),
|
|
289
|
+
}),
|
|
290
|
+
run({ scratch }, { name, lines }) {
|
|
291
|
+
const dir = scratch.dir();
|
|
292
|
+
const body = lines.endsWith("\n") ? lines : lines + "\n";
|
|
293
|
+
writeFileSync(join(dir, name), body);
|
|
294
|
+
return { dir, bytes: Buffer.byteLength(body) };
|
|
295
|
+
},
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
`nuka check` compares the pattern and the args in both directions. A
|
|
299
|
+
capture with no args key is an error, and so is a required args key that
|
|
300
|
+
nothing on the line fills. A table or a doc string under a line whose step
|
|
301
|
+
has two or more keys that no capture and no `from` fills is an error too
|
|
302
|
+
(`table-docstring-key-mismatch`): nukadoko cannot know which key it fills.
|
|
303
|
+
|
|
304
|
+
## A step's contract
|
|
305
|
+
|
|
306
|
+
The fields of a step are its contract. Other people and tools read the
|
|
307
|
+
contract without running the step:
|
|
308
|
+
|
|
309
|
+
- **`pattern`**: the sentence that the step binds. More wordings of the
|
|
310
|
+
same step go in `patterns`, and each wording captures the same keys.
|
|
311
|
+
- **`description`**: what the step does, in one sentence.
|
|
312
|
+
- **`args`**: each value that the step takes, with its type and a
|
|
313
|
+
description.
|
|
314
|
+
- **`returns`**: each value that the step gives to a later step, with its
|
|
315
|
+
type and a description. A step that returns nothing leaves it out.
|
|
316
|
+
- **`mutates`**: a Given or a When that changes the system a later scenario
|
|
317
|
+
reads says `mutates` `true`. This is the value when you do not write it.
|
|
318
|
+
A Given or a When that only reads, or writes only in its own temporary
|
|
319
|
+
directory, says `false`. A Then does not declare `mutates` or `returns`,
|
|
320
|
+
because a claim step only reads.
|
|
321
|
+
|
|
322
|
+
Each field has a description because the contract is the only part of the
|
|
323
|
+
step that a reader of the vocabulary sees. A person who writes the next
|
|
324
|
+
scenario, or an agent that looks for a step to reuse, reads `nuka steps`
|
|
325
|
+
and `nuka describe`, not the step file. `nuka steps` lists each step with
|
|
326
|
+
its pattern, its description, and its claims. `nuka describe <step>` prints
|
|
327
|
+
the full contract of one step, with `args` and `returns` as JSON Schema. See
|
|
328
|
+
[nuka steps and nuka describe](commands.md#nuka-steps-and-nuka-describe)
|
|
329
|
+
for the output.
|
|
330
|
+
|
|
331
|
+
Before you write a new step, read the vocabulary. When a step already says
|
|
332
|
+
what the criterion says, use it.
|
|
333
|
+
|
|
334
|
+
## Claims
|
|
335
|
+
|
|
336
|
+
A claim is one comparison that nukadoko does for a Then line. It has these
|
|
337
|
+
parts:
|
|
338
|
+
|
|
339
|
+
- **`actual`**: the path of the value to read. Its first segment is a key
|
|
340
|
+
that `observe` returns, a key that `from` fills (see
|
|
341
|
+
[Passing values between steps](#passing-values-between-steps)), or a
|
|
342
|
+
key that the step declares with `files` or `events` (see
|
|
343
|
+
[Files an earlier step changed](spec.md#files-an-earlier-step-changed)
|
|
344
|
+
and [A claim on a count of events](spec.md#a-claim-on-a-count-of-events)
|
|
345
|
+
in the spec).
|
|
346
|
+
- **`compare`**: how to compare the two values, for example `equal` or
|
|
347
|
+
`has-item`.
|
|
348
|
+
- **`expected`**: where the expected value comes from. Usually it is an
|
|
349
|
+
args key that the line fills: a capture, the table, or the doc string.
|
|
350
|
+
- **`view`**: how to read the actual value before the comparison, for
|
|
351
|
+
example as `text` or as `lines`. `at` then picks one item.
|
|
352
|
+
|
|
353
|
+
The tally Thens show three claims. The exit code is equal to the capture
|
|
354
|
+
`code`. The output, read as text, is equal to the doc string. The first
|
|
355
|
+
line of stderr is equal to the capture `text`:
|
|
356
|
+
|
|
357
|
+
```ruby
|
|
358
|
+
# exits_with.rb: "it exits with {code:int}"
|
|
359
|
+
claims [{ actual: "exitCode", compare: "equal", expected: "code" }]
|
|
360
|
+
# output_is.rb: "the output is", with a doc string
|
|
361
|
+
claims [{ actual: "stdout", view: "text", compare: "equal", expected: "expected" }]
|
|
362
|
+
# error_says.rb: "the error says {text:string}"
|
|
363
|
+
claims [{ actual: "stderr", view: "lines", at: "0", compare: "equal", expected: "text" }]
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
```ts
|
|
367
|
+
// exits-with.ts: "it exits with {code:int}"
|
|
368
|
+
claims: [{ actual: "exitCode", compare: "equal", expected: "code" }],
|
|
369
|
+
// output-is.ts: "the output is", with a doc string
|
|
370
|
+
claims: [{ actual: "stdout", view: "text", compare: "equal", expected: "expected" }],
|
|
371
|
+
// error-says.ts: "the error says {text:string}"
|
|
372
|
+
claims: [{ actual: "stderr", view: "lines", at: "0", compare: "equal", expected: "text" }],
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
A claim with `each` judges the items of a list. The todo step `the todo
|
|
376
|
+
titled {title:string} is marked {state:word}` has one: its `where` picks
|
|
377
|
+
the todos with the captured title, and its own claims compare the `state`
|
|
378
|
+
of each one with the captured state.
|
|
379
|
+
|
|
380
|
+
When a claim does not hold, the failed step prints both values and where
|
|
381
|
+
each came from. This is a run of the first tally scenario (line 9 of
|
|
382
|
+
`features/tally.feature`) after `rent: 100` in its expected output was
|
|
383
|
+
changed to `rent: 101`. Both engines print the same lines. Only the run ids
|
|
384
|
+
and the times change from run to run:
|
|
385
|
+
|
|
386
|
+
```text
|
|
387
|
+
scenario 1/1 features/tally.feature:9 totals per category, sorted by name
|
|
388
|
+
step 1/4 passed 0.0s a file "input.csv" with these lines
|
|
389
|
+
step 2/4 passed 0.1s I run tally with "input.csv"
|
|
390
|
+
step 3/4 passed 0.0s it exits with 0
|
|
391
|
+
step 4/4 failed 0.0s the output is
|
|
392
|
+
claim broken: "food: 5.5\nrent: 100" (from:run-tally@16.stdout as text) equal "food: 5.5\nrent: 101" (sentence:expected); first difference at line 2: actual "rent: 100", expected "rent: 101"
|
|
393
|
+
record .nukadoko/runs/run-20261203-234629-yxy8/steps/step-20261203-234629-w9sm
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
The expected value comes from the line, so a reader of the feature file
|
|
397
|
+
sees the criterion. A claim can also take a literal value, but only when
|
|
398
|
+
the fixed words of the pattern state that value: `the command exits 0` may
|
|
399
|
+
claim `0`, and `the command succeeds` may not. The full rules, the list of
|
|
400
|
+
sources, and each compare are in [Claims](spec.md#claims) in the spec.
|
|
401
|
+
|
|
402
|
+
## Passing values between steps
|
|
403
|
+
|
|
404
|
+
The tally When runs the program in the directory that a Given made. The
|
|
405
|
+
Thens read what the program printed. `from` carries each of these values:
|
|
406
|
+
`from` names an args key, the earlier step, and the key of its result.
|
|
407
|
+
nukadoko fills the args key before the step runs.
|
|
408
|
+
|
|
409
|
+
The When reads `dir` from either of two Givens. Exactly one of them must
|
|
410
|
+
come earlier in the scenario: when both come earlier, `nuka check`
|
|
411
|
+
reports it (see [Chaining steps](spec.md#chaining-steps) in the spec).
|
|
412
|
+
The args key `dir` has the same type as the `dir` key that the Givens
|
|
413
|
+
return. This is the part of the step that does it, and its
|
|
414
|
+
body (its `returns` gives `exitCode`, `stdout`, and `stderr`):
|
|
415
|
+
|
|
416
|
+
```ruby
|
|
417
|
+
pattern "I run tally with {argv:string}"
|
|
418
|
+
args do
|
|
419
|
+
string :argv, "Arguments after `tally`, separated by spaces"
|
|
420
|
+
field :dir, ACsvFileWith.returns[:dir]
|
|
421
|
+
end
|
|
422
|
+
from dir: [[ACsvFileWith, :dir], [AnEmptyDirectory, :dir]]
|
|
423
|
+
|
|
424
|
+
def run(args:) = Nukadoko.run_command("node", [File.expand_path("src/cli.ts"), *args.argv.split], cwd: args.dir)
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
```ts
|
|
428
|
+
pattern: "I run tally with {argv:string}",
|
|
429
|
+
args: z.object({
|
|
430
|
+
argv: z.string().describe("Arguments after `tally`, separated by spaces"),
|
|
431
|
+
dir: aCsvFileWith.returns.shape.dir,
|
|
432
|
+
}),
|
|
433
|
+
from: {
|
|
434
|
+
dir: [[aCsvFileWith, "dir"], [anEmptyDirectory, "dir"]],
|
|
435
|
+
},
|
|
436
|
+
async run({}, { argv, dir }) {
|
|
437
|
+
return await runCommand(process.execPath, [cli, ...argv.split(/\s+/).filter((part) => part !== "")], { cwd: dir });
|
|
438
|
+
},
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
The run-command helper that the body calls returns the exit code and the
|
|
442
|
+
output, and does not raise on a nonzero exit. It also writes the process
|
|
443
|
+
into the step record: the record that nukadoko writes for each step that
|
|
444
|
+
runs.
|
|
445
|
+
|
|
446
|
+
The Then `it exits with {code:int}` reads `exitCode` from the When in the
|
|
447
|
+
same way, and compares it with the capture:
|
|
448
|
+
|
|
449
|
+
```ruby
|
|
450
|
+
from exitCode: [RunTally, :exitCode]
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
```ts
|
|
454
|
+
from: {
|
|
455
|
+
exitCode: [runTally, "exitCode"],
|
|
456
|
+
},
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
Why `from`, and not a variable that two steps share? Because `from` is part
|
|
460
|
+
of the contract. `nuka check` reads it and finds a scenario where the
|
|
461
|
+
producing step is not earlier, before anything runs. The step record shows
|
|
462
|
+
which line each value came from. A shared variable shows nothing, and a
|
|
463
|
+
wrong order fails only when the scenario runs. When the same step runs
|
|
464
|
+
twice in one scenario, `from` reads its most recent result. To run such a
|
|
465
|
+
step alone, see [nuka do](commands.md#nuka-do).
|
|
466
|
+
|
|
467
|
+
## Fixtures a step can ask for
|
|
468
|
+
|
|
469
|
+
A fixture is a value that nukadoko gives to a step. A step asks for a
|
|
470
|
+
fixture when it names it as a parameter of `run` or `observe`, as the todo
|
|
471
|
+
steps above name `request`. nukadoko builds only the fixtures that a step
|
|
472
|
+
names, so a step that names no browser fixture starts no browser.
|
|
473
|
+
|
|
474
|
+
| What it gives | Ruby keyword | TypeScript name |
|
|
475
|
+
|---|---|---|
|
|
476
|
+
| an HTTP client with the base URL of the program | `request` | `request` |
|
|
477
|
+
| a browser page in a fresh browser context | `page` | `page` |
|
|
478
|
+
| the browser context of that page, for a second tab | `context` | `context` |
|
|
479
|
+
| a page for a named person, in a browser context of its own | `page_as` | `pageAs` |
|
|
480
|
+
| temporary directories, removed when the scenario ends | `scratch` | `scratch` |
|
|
481
|
+
| the configured environment variables, read-only | `env` | `env` |
|
|
482
|
+
| one required variable, which raises when it is missing or empty | `require_env` | `requireEnv` |
|
|
483
|
+
| the base URL of the program under test (with several services, the URL of `main`) | `base_url` | `baseURL` |
|
|
484
|
+
| the URL of each service, by name (see [Several services](web-app.md#several-services)) | `services` | `services` |
|
|
485
|
+
| what the program's `setup` returned, once for each system (see [A test API](web-app.md#a-test-api)) | `setup_result` | `setupResult` |
|
|
486
|
+
| a named stage of the step in its record | `section` | `section` |
|
|
487
|
+
| a wait until a function gives a value, with a time limit | `poll` | `poll` |
|
|
488
|
+
| a file of your own, attached to the step record | `evidence` | `evidence` |
|
|
489
|
+
| the result of an earlier step, when `from` cannot express the read | `result_of` | `resultOf` |
|
|
490
|
+
| a call to a part of this step (see [Parts, tags, and environments](#parts-tags-and-environments)) | `call` | `call` |
|
|
491
|
+
|
|
492
|
+
`nuka check` reports a name that is not a fixture. The details are in
|
|
493
|
+
[Context API](spec.md#context-api) in the spec. A project adds its own
|
|
494
|
+
fixture in its config file. The sign-up project in
|
|
495
|
+
[conformance/cases/workflow](https://github.com/meganemura/nukadoko/tree/main/conformance/cases/workflow)
|
|
496
|
+
gives each scenario a new `store`:
|
|
497
|
+
|
|
498
|
+
<!-- engine: ruby -->
|
|
499
|
+
```ruby
|
|
500
|
+
require_relative "src/signup"
|
|
501
|
+
|
|
502
|
+
Nukadoko.fixture(:store) { |use| use.(Signup::Store.new) }
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
<!-- engine: typescript -->
|
|
506
|
+
```ts
|
|
507
|
+
import { defineConfig, defineFixtures } from "nukadoko";
|
|
508
|
+
import { createStore, type Store } from "./src/signup.ts";
|
|
509
|
+
|
|
510
|
+
export default defineConfig({
|
|
511
|
+
fixtures: defineFixtures({
|
|
512
|
+
store: async ({}, use) => { await use(createStore()); },
|
|
513
|
+
}),
|
|
514
|
+
});
|
|
515
|
+
|
|
516
|
+
declare module "nukadoko" {
|
|
517
|
+
interface StepFixtures {
|
|
518
|
+
store: Store;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
The code after `use` is the teardown. It runs when the scenario ends, also
|
|
524
|
+
after a failure. Scopes and teardown are in
|
|
525
|
+
[Fixtures (Ruby)](ruby/reference.md#fixtures) and
|
|
526
|
+
[Fixtures (TypeScript)](typescript/reference.md#fixtures).
|
|
527
|
+
|
|
528
|
+
## Parts, tags, and environments
|
|
529
|
+
|
|
530
|
+
A step can call other steps as its **parts**. List them in `parts`, and run
|
|
531
|
+
each one through the `call` fixture. nukadoko checks the args and the
|
|
532
|
+
result of each call, and writes each call into the record of the calling
|
|
533
|
+
step. Use parts when a second scenario needs half of a step: the step keeps
|
|
534
|
+
its pattern, so the feature file does not change. See [Parts](spec.md#parts)
|
|
535
|
+
in the spec, and the Parts section of the [Ruby](ruby/reference.md#parts)
|
|
536
|
+
and [TypeScript](typescript/reference.md#parts) references.
|
|
537
|
+
|
|
538
|
+
A tag above a scenario, such as `@smoke`, lets you select scenarios. `nuka
|
|
539
|
+
run --tag @smoke` runs only the scenarios with that tag, and `--tag "not
|
|
540
|
+
@smoke"` runs the others.
|
|
541
|
+
|
|
542
|
+
The tags `@with:<condition>` and `@without:<condition>` name a switch of
|
|
543
|
+
the program, such as a feature flag. An environment of the `program` in
|
|
544
|
+
the config declares the conditions it runs with. A `nuka run` without
|
|
545
|
+
`--env` runs the environments that `defaultEnvironments` names, or else
|
|
546
|
+
each environment that declares `conditions`. `--env <name>` selects one.
|
|
547
|
+
What a tag makes a scenario in each environment is in
|
|
548
|
+
[Environments](spec.md#environments) and [Verdicts](spec.md#verdicts) in
|
|
549
|
+
the spec. [The program under test](web-app.md#the-program-under-test)
|
|
550
|
+
shows how the config starts the program. The
|
|
551
|
+
[CI guide](ci.md#what-a-team-adds-on-top) shows both sides of a switch in
|
|
552
|
+
one CI job.
|
|
553
|
+
|
|
554
|
+
## Mistakes nuka check catches
|
|
555
|
+
|
|
556
|
+
`nuka check` reads the feature files and the step files. It reports each
|
|
557
|
+
mistake before anything runs. `nuka run` runs the same check first, and
|
|
558
|
+
does not start when it finds an error. [nuka check](commands.md#nuka-check)
|
|
559
|
+
shows worked examples, and `nuka check --codes` lists every finding code.
|
|
560
|
+
|
|
561
|
+
---
|
|
562
|
+
|
|
563
|
+
[Japanese](writing-scenarios.ja.md)
|
data/lib/nukadoko/base.rb
CHANGED
|
@@ -73,8 +73,8 @@ module Nukadoko
|
|
|
73
73
|
|
|
74
74
|
# `selected` is each selected scenario's [feature, line]; `targets` the
|
|
75
75
|
# run's targets without a line, or nil for the features directory.
|
|
76
|
-
#: (project: String, ref: String, commit: String, run_dir: String, selected: Array[[String, Integer]], targets: Array[String]?, envs: Array[String], head_program: Hash[Symbol, untyped]?) -> void
|
|
77
|
-
def initialize(project:, ref:, commit:, run_dir:, selected:, targets:, envs:, head_program:)
|
|
76
|
+
#: (project: String, ref: String, commit: String, run_dir: String, selected: Array[[String, Integer]], targets: Array[String]?, envs: Array[String], head_program: Hash[Symbol, untyped]?, ?paths_wanted: bool) -> void
|
|
77
|
+
def initialize(project:, ref:, commit:, run_dir:, selected:, targets:, envs:, head_program:, paths_wanted: false)
|
|
78
78
|
@project = project
|
|
79
79
|
@ref = ref
|
|
80
80
|
@commit = commit
|
|
@@ -83,6 +83,7 @@ module Nukadoko
|
|
|
83
83
|
@prefix = Base.git(project, "rev-parse", "--show-prefix").first.delete_suffix("/")
|
|
84
84
|
@base_top = File.join(@trees, "base")
|
|
85
85
|
@old_top = File.join(@trees, "old")
|
|
86
|
+
@paths_wanted = paths_wanted
|
|
86
87
|
prepare(selected, targets, envs, head_program)
|
|
87
88
|
rescue StandardError
|
|
88
89
|
cleanup
|
|
@@ -142,7 +143,13 @@ module Nukadoko
|
|
|
142
143
|
@mapping = compare_mapping(head_files, ref_files, base_project, head_program, ref_program)
|
|
143
144
|
|
|
144
145
|
wanted = selected.map { @changes[_1] }
|
|
145
|
-
|
|
146
|
+
# A change with no new or changed criterion, a refactor among them,
|
|
147
|
+
# is the one whose paths a reader most wants compared: an unchanged
|
|
148
|
+
# criterion that did the same at the base is its evidence. So the
|
|
149
|
+
# base system is made for paths alone too, when head's program writes
|
|
150
|
+
# the events they are read from. Its unchanged rows are no cells, so
|
|
151
|
+
# they move no verdict.
|
|
152
|
+
base_needed = wanted.any? { %w[changed new].include?(_1&.dig(:change)) } || (@paths_wanted && wanted.any?)
|
|
146
153
|
old_needed = wanted.any? { _1&.dig(:change) == "unchanged" && (@mapping[:changed] || _1[:retagged] || _1[:renamed_from]) }
|
|
147
154
|
write_old_tree(head_files, ref_files) if old_needed
|
|
148
155
|
if base_needed
|
|
@@ -157,9 +164,9 @@ module Nukadoko
|
|
|
157
164
|
@old_environments = old_environments_of(ref_program, envs)
|
|
158
165
|
end
|
|
159
166
|
|
|
160
|
-
# The environments the old
|
|
167
|
+
# The environments the old system runs in, with the conditions the ref's
|
|
161
168
|
# program gives each; nil when the ref has no program, so
|
|
162
|
-
# head's environments are the old
|
|
169
|
+
# head's environments are the old system's too.
|
|
163
170
|
#: (Hash[Symbol, untyped]?, Array[String]) -> Array[Environment]?
|
|
164
171
|
def old_environments_of(program, envs)
|
|
165
172
|
return nil if program.nil? || program[:problem]
|