nukadoko 0.3.0 → 0.5.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 +93 -0
- data/README.ja.md +11 -1
- data/README.md +10 -2
- data/lib/nukadoko/check.rb +73 -5
- data/lib/nukadoko/claim_sides.rb +12 -0
- data/lib/nukadoko/cli.rb +9 -1
- data/lib/nukadoko/command.rb +22 -4
- data/lib/nukadoko/error_frames.rb +44 -0
- data/lib/nukadoko/features.rb +3 -1
- data/lib/nukadoko/fixtures.rb +108 -7
- data/lib/nukadoko/parameter_types.rb +54 -0
- data/lib/nukadoko/pattern.rb +52 -2
- data/lib/nukadoko/run.rb +134 -28
- data/lib/nukadoko/run_record.rb +9 -5
- data/lib/nukadoko/scaffold.rb +2 -2
- data/lib/nukadoko/schema.rb +165 -37
- data/lib/nukadoko/step_fixtures.rb +225 -0
- data/lib/nukadoko/trace_actions.rb +4 -2
- data/lib/nukadoko/version.rb +1 -1
- data/lib/nukadoko/vocabulary.rb +1 -1
- data/lib/nukadoko.rb +4 -0
- data/llms.txt +10 -8
- data/sig/generated/nukadoko/check.rbs +10 -0
- data/sig/generated/nukadoko/claim_sides.rbs +13 -4
- data/sig/generated/nukadoko/command.rbs +13 -4
- data/sig/generated/nukadoko/error_frames.rbs +24 -0
- data/sig/generated/nukadoko/fixtures.rbs +38 -2
- data/sig/generated/nukadoko/parameter_types.rbs +27 -0
- data/sig/generated/nukadoko/pattern.rbs +25 -1
- data/sig/generated/nukadoko/run.rbs +32 -4
- data/sig/generated/nukadoko/schema.rbs +91 -27
- data/sig/generated/nukadoko/step_fixtures.rbs +129 -0
- data/sig/generated/nukadoko/trace_actions.rbs +3 -1
- data/skills/nukadoko/SKILL.md +1 -1
- data/skills/nukadoko/references/ruby.md +80 -0
- metadata +12 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3375431e3b4b0c689e3a373ec2499db0376b35e1e2e9d0afadf663376e3a7517
|
|
4
|
+
data.tar.gz: 185c957dbb5f4217848c3ca69a733a215d4650147ad16fcd62f88eb0fb082c53
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 55c28401e1fe5cfad034aa378ee47ee43ba89e839424ec14de0b0151adbba6978e0022b20b563f01e956f5b34b72dcbdf2bb28a10c83f649ad8a206294a7af32
|
|
7
|
+
data.tar.gz: d8a0896d47e907f885cbd94120d84664ce86124a9afe3817ac572d5046871f3ef9e276d42d513bf55bcdad6fe702fa4f9a310f3f99d1e7fcef3902fa469ce8b4
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,99 @@ notes come from the section below whose heading starts with `## [<version>]`.
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.5.0] - 2026-11-16
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- The fixtures the TypeScript engine gives on ctx and the Ruby engine
|
|
14
|
+
lacked: `context`, `pageAs` (a browser context of its own per name, with
|
|
15
|
+
`trace.<name>.zip` per step and `final.<name>.png` per scenario),
|
|
16
|
+
`section`, `poll` (a block called until it gives a value, kept in
|
|
17
|
+
`polls`), `evidence` (`attach` and `path`, kept in
|
|
18
|
+
`evidence.attachments`), and `resultOf`. Before, `nuka check` accepted
|
|
19
|
+
some of these names and the run then failed with "the Ruby engine has no
|
|
20
|
+
fixture ... yet"; now each name check accepts is one the run gives.
|
|
21
|
+
- `base_url:`, `require_env:`, `page_as:`, and `result_of:` name the same
|
|
22
|
+
fixtures as `baseURL:`, `requireEnv:`, `pageAs:`, and `resultOf:`, so a
|
|
23
|
+
step body passes RuboCop's naming cops.
|
|
24
|
+
- A step record lists each key `requireEnv` was asked for in
|
|
25
|
+
`required_env`, as the TypeScript engine does. An empty value counts as
|
|
26
|
+
missing.
|
|
27
|
+
|
|
28
|
+
- A project fixture can name a builtin (`page`, `request`, `env`,
|
|
29
|
+
`requireEnv`, `baseURL`, `scratch`), and one with a builtin's name
|
|
30
|
+
replaces it for every step while its own keyword of that name is the
|
|
31
|
+
builtin, so `Nukadoko.fixture(:page) { |use, page:| ...; use.(page) }`
|
|
32
|
+
wraps the page each step gets. `nuka check` reports `page-override-unowned`
|
|
33
|
+
for a `page` override that names no browser fixture.
|
|
34
|
+
|
|
35
|
+
- The `request` fixture sends an absolute `https` URL over TLS and works in
|
|
36
|
+
a project with no program, so a step can call a third-party API and keep
|
|
37
|
+
its requests in `http.jsonl`. A path in a world with no URL is refused
|
|
38
|
+
with that reason.
|
|
39
|
+
|
|
40
|
+
- `args` and `returns` declare what zod declares: `array :todos do ... end`
|
|
41
|
+
for a list of objects, `numbers` and `integers` beside `strings`,
|
|
42
|
+
`array :x, of:` for any item type, `optional: true`, `default:`, and the
|
|
43
|
+
bounds `min:`, `max:`, `positive:`, and `negative:` (and `each:` for an
|
|
44
|
+
array's items). The problems and the JSON Schema `nuka describe` prints
|
|
45
|
+
are zod's. A key `from` fills in some scenarios only can be optional, and
|
|
46
|
+
stays absent where no producer ran.
|
|
47
|
+
- The README says how files under `features/steps/` load, so a helper
|
|
48
|
+
module named after its file can be used from any step.
|
|
49
|
+
|
|
50
|
+
### Changed
|
|
51
|
+
|
|
52
|
+
- An `integer` field's JSON Schema has the `minimum` and `maximum` zod
|
|
53
|
+
gives `z.int()`.
|
|
54
|
+
|
|
55
|
+
- `Nukadoko.run_command(..., unbundled: true)` runs the command with the
|
|
56
|
+
environment from before Bundler set up nuka, so `bin/rails runner` in
|
|
57
|
+
another Ruby project loads its own Gemfile instead of nuka's.
|
|
58
|
+
|
|
59
|
+
- A failed step record whose `error.kind` is `step_error` carries
|
|
60
|
+
`error.at`: the project's own backtrace frames, each `path:line` relative
|
|
61
|
+
to the project root, at most five, redacted like the message. A reader
|
|
62
|
+
finds the line that raised without calling the step again.
|
|
63
|
+
|
|
64
|
+
### Fixed
|
|
65
|
+
|
|
66
|
+
- Every command stopped with `NoMethodError` on a feature file that has a
|
|
67
|
+
`Rule:`. The engine now reads the scenarios and the background under each
|
|
68
|
+
rule.
|
|
69
|
+
- A page step could wait forever when the run did not start through
|
|
70
|
+
`exe/nuka` and the locale was not UTF-8 (`LANG` unset): the Playwright
|
|
71
|
+
client read the driver's output as US-ASCII and its reader thread died on
|
|
72
|
+
the first non-ASCII byte. The engine sets UTF-8 before it starts the
|
|
73
|
+
driver.
|
|
74
|
+
|
|
75
|
+
## [0.4.0] - 2026-11-16
|
|
76
|
+
|
|
77
|
+
### Changed
|
|
78
|
+
|
|
79
|
+
- The gem accepts `playwright-ruby-client` 1.63.0 and later, in place of
|
|
80
|
+
exactly 1.61.0.
|
|
81
|
+
|
|
82
|
+
### Fixed
|
|
83
|
+
|
|
84
|
+
- A step record on a Playwright 1.63 driver had no `actions`: the driver
|
|
85
|
+
writes trace format version 9, which the engine now reads.
|
|
86
|
+
|
|
87
|
+
### Added
|
|
88
|
+
|
|
89
|
+
- `Nukadoko.config(parameterTypes: [...])` registers custom parameter types, as
|
|
90
|
+
the TypeScript engine's `parameterTypes` does: each a `name`, a `regexp`
|
|
91
|
+
(a Ruby Regexp or a string), and an optional `transformer` lambda. A step
|
|
92
|
+
can read a value inside a sentence with no spaces around it, such as
|
|
93
|
+
`優先度{priority:priority}のタスクを足す`, without quotes in the feature
|
|
94
|
+
file. A shape the TypeScript schema refuses is `config-invalid` with its
|
|
95
|
+
words. `nuka check` reports `parameter-type-invalid` for a type that takes
|
|
96
|
+
a built-in name or repeats one, `parameter-type-unused` for one no
|
|
97
|
+
pattern names, and `claim-expected-transformed` for a claim that compares
|
|
98
|
+
with a capture a transformer rewrote, which a run under `--no-check`
|
|
99
|
+
leaves unjudged. A run under `--no-check` stops with
|
|
100
|
+
`parameter-type-collision` when the types do not register.
|
|
101
|
+
|
|
9
102
|
## [0.3.0] - 2026-11-16
|
|
10
103
|
|
|
11
104
|
### Changed
|
data/README.ja.md
CHANGED
|
@@ -44,8 +44,15 @@ end
|
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
- nil を許すフィールドには `null: true` を付けます。`enum :outcome, %w[accepted refused]` はその語だけを許し、Steep はリテラルの和として扱います。
|
|
47
|
+
- `optional: true` はキーがなくてもよいことを表し、本体には nil が渡ります(zod の `.optional()`)。`from` が一部のシナリオでだけ埋めるキーに使います。`default: 10` は、キーがないときにその値を渡します(`.default(10)`)。`min:`、`max:`、`positive: true`、`negative: true` は、数の値、文字列の長さ、配列の要素数の範囲を決め、zod と同じメッセージを出します。
|
|
48
|
+
- `array :todos do string :id end` はオブジェクトの配列です。`strings`、`numbers`、`integers` は 1 つのスカラー型の配列で、`array :ids, of: :string` は任意の要素型を指定します。`each: { positive: true }` はすべての要素の範囲を決めます。
|
|
49
|
+
- `features/steps/` の下の `*.rb` は、`features/steps/lib/` の補助ファイルも含めてすべて読み込まれます。ステップのクラスはファイル名を CamelCase にした名前で探します(`add_todo.rb` は `AddTodo` を定義します)。補助モジュールも同じ決まりで名付ければ(`lib/todo_api.rb` は `TodoApi`)、どのステップからも `require` なしで使えます。
|
|
47
50
|
- パターンの取り出し部分にはすべて名前を付けます。名前は `args` のキーです。
|
|
48
51
|
- `run`(Then ステップでは `observe`)のキーワード引数が、ステップが使うフィクスチャです。`nuka check` は本体を呼ばずに `Method#parameters` で読みます。
|
|
52
|
+
- `request` フィクスチャは `get`、`post`、`put`、`patch`、`delete` を送り、それぞれをステップの `http.jsonl` に記録します。パスはプログラムの URL につなげます。`http` か `https` の絶対 URL はその場所に送るので、外部の API も呼べます。プログラムのないプロジェクトでも使えます。
|
|
53
|
+
- `context` は `page` が属するブラウザコンテキストです。`page_as.("aki", { javaScriptEnabled: false })` は、その名前だけのブラウザコンテキストのページを返します。シナリオに 2 人目がいても、その人の cookie は別になります。同じ名前で後から呼ぶと、同じページが返ります。呼んだステップには `trace.aki.zip` が残り、シナリオの終わりに `final.aki.png` が残ります。
|
|
54
|
+
- `section.("label")` は本体がどこまで進んだかを記録の `sections` に残します。`poll.(description: "the order", timeout: 30_000, interval: 500) { 値か nil }` は、ブロックが値を返すまで呼び直します。時間切れなら `Nukadoko::PollTimeoutError` を出し、呼び出しごとに `polls` に残します。`evidence.attach(name, body)` はステップ自身のディレクトリにファイルを書き、`evidence.path(name)` はそこに書くためのパスを返します。どちらも記録の `evidence.attachments` に載ります。`result_of.(MakeTotal)` は、シナリオの前のステップが最後に返した値を読みます。まだなければ nil です。
|
|
55
|
+
- `base_url:`、`require_env:`、`page_as:`、`result_of:` は、`baseURL`、`requireEnv`、`pageAs`、`resultOf` の snake_case の名前です。RuboCop の命名の cop に引っかかりません。どちらの名前でも同じフィクスチャです。`require_env.("KEY")` はキーがないか空のときに例外を出し、記録の `required_env` に聞いたキーを並べます。
|
|
49
56
|
- Then ステップは `claims` と、世界を読む `observe` を書きます。claim の判定は nukadoko が行います。claim が比べる args のキーは `observe` に渡されません。
|
|
50
57
|
|
|
51
58
|
## コマンド
|
|
@@ -98,8 +105,11 @@ gem が入れる実行ファイルには、`bundle binstubs <gem>` が `bin/<nam
|
|
|
98
105
|
`--then` とキャプチャ 1 つと一緒に使うと、claim がその 2 つを比べるので、ステップは書き直さずに使えます。
|
|
99
106
|
- ブラウザの起動設定は `nukadoko.config.rb` に `Nukadoko.config(browser: { executablePath: "..." })` と書きます。`page` を使うステップは、シナリオごとに自分のブラウザコンテキストを持ちます。ステップの記録には、ページが送ったリクエストとステップのトレースが残ります。
|
|
100
107
|
- `scratch` を使うステップは `scratch.dir` で新しいディレクトリを得ます。シナリオが終わると消えます。`scratch.copy(source)` は、プロジェクトのファイルかディレクトリの写しを入れた新しいディレクトリを返します。`args:` キーワードを書かない本体は、args なしで呼ばれます。`Nukadoko.run_command(command, args, cwd:, env:, input:, timeout:, redact:)` はプログラムを実行し、`{ exitCode:, signal:, stdout:, stderr: }` を返します。ステップの記録には実行したプロセスが残り、`redact:` に渡した値は `{{secret.NAME}}` になります。
|
|
108
|
+
プログラムは nuka の環境変数を受け継ぎ、`bundle exec` の下では nuka の Gemfile を指します。
|
|
109
|
+
別の Ruby プロジェクトのコマンド(`bin/rails runner` など)を動かすときは、`unbundled: true` で Bundler が入る前の環境変数を使います。
|
|
101
110
|
- `Nukadoko.config(envFiles: [".env"])` は env ファイルを `env` フィクスチャに読み込みます。config の `program:` の環境は、その後ろに自分の `envFiles:` を足せます。git が追跡していないファイルと HEAD と違うファイルは秘密の出どころです。その 4 文字以上の値は、ステップの記録、`http.jsonl`、`nuka do` の出力で `{{secret.NAME}}` に置き換わります。ステップが表示したものは、秘密を伏せて stderr に出ます。`secrets: { public: [...], redact: [...] }` で、そのようなキーを平文のままにしたり、追跡しているファイルのキーを伏せたりできます。`nuka check` は、無いファイル、読み飛ばした行、どのファイルにもない `secrets` のキーを警告し、値は表示しません。
|
|
102
|
-
-
|
|
111
|
+
- `Nukadoko.config(parameterTypes: [{ name: "priority", regexp: /高|低/, transformer: ->(s) { s == "高" ? "high" : "low" } }])` は、TypeScript の config の `parameterTypes` と同じようにパラメータ型を登録します。前後に空白のない文の中の値も、`{p:priority}` で読めます。regexp は Ruby の Regexp か文字列です。transformer は省いてもよく、regexp が捕まえたグループを受け取ります。`nuka check` は、組み込みの名前を使う型、どのパターンも使わない型、transformer が書き換えた値と比べる主張を報告します。
|
|
112
|
+
- プロジェクトのフィクスチャは `nukadoko.config.rb` に書きます。ブロックは値を `use` に渡し、その後ろが後片付けです。例: `Nukadoko.fixture(:store) { |use| use.(Store.new) }`。`scope: :process` にすると、環境ごとの実行全体で 1 つの値を使います。キーワード引数は、フィクスチャが使うもの(別のプロジェクトのフィクスチャか、`page`、`request`、`env`、`requireEnv`、`baseURL`、`scratch` などの組み込み)を表します。組み込みと同じ名前のフィクスチャは、すべてのステップでそれを置き換えます。そのフィクスチャ自身の `page:` は組み込みの page なので、包んで渡せます。例: `Nukadoko.fixture(:page) { |use, page:| page.set_default_navigation_timeout(10_000); use.(page) }`。`page`、`context`、`pageAs` のどれも受け取らない `page` の上書きは、`nuka check` が `page-override-unowned` で止めます。
|
|
103
113
|
- `parts [CreateTodo, CompleteById]` で、ステップが呼べるステップを宣言します。`call.(CreateTodo, title: args.title)` で 1 つを実行し、args と返り値を確かめます。パターンのない part も書けます。呼び出しは、呼んだステップの記録の `calls` に残ります。`nuka check` は、`parts` の循環と、`mutates false` なのに `mutates true` の part を持つステップを報告します。
|
|
104
114
|
- `poll timeout_ms: 3000` は、すべての claim が 2 回続けて成り立つか時間切れになるまで、100 ミリ秒おきに `observe` を読み直します。`settled:` には、一度なったら変わらない状態を書きます。2 回続けてその状態なら、壊れた claim を待つのをやめます。読んだ結果はすべてステップの記録に残ります。
|
|
105
115
|
- `nuka steps [--json]` は語彙の一覧を出します。`nuka describe <step>` は 1 つのステップを、args と返り値の JSON Schema とともに出します。項目は TypeScript 版と同じです。
|
data/README.md
CHANGED
|
@@ -34,8 +34,15 @@ end
|
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
- A field takes `null: true` when nil is allowed. `enum :outcome, %w[accepted refused]` allows only those words, and Steep sees them as a union of literals.
|
|
37
|
+
- `optional: true` lets the key be absent, and the body reads nil, as zod's `.optional()`: a key that `from` fills in some scenarios only. `default: 10` reads an absent key as that value, as `.default(10)`. `min:`, `max:`, `positive: true`, and `negative: true` bound a number's value, a string's length, and an array's item count, with zod's messages.
|
|
38
|
+
- `array :todos do string :id end` is a list of objects. `strings`, `numbers`, and `integers` are lists of one scalar type, and `array :ids, of: :string` names any item type. `each: { positive: true }` bounds every item.
|
|
39
|
+
- Every `*.rb` file under `features/steps/` is loaded, a helper under `features/steps/lib/` too. A step class is looked up by the CamelCase form of its file name (`add_todo.rb` defines `AddTodo`), so a helper module named the same way (`lib/todo_api.rb` defines `TodoApi`) can be used from any step without a `require`.
|
|
37
40
|
- Every capture in the pattern is named, and each name is a key of `args`.
|
|
38
41
|
- The keyword arguments of `run` (or `observe`, in a Then step) name the fixtures the step needs. `nuka check` reads them with `Method#parameters`, without calling the body.
|
|
42
|
+
- The `request` fixture sends `get`, `post`, `put`, `patch`, and `delete` and records each in the step's `http.jsonl`. A path joins the program's URL; an absolute `http` or `https` URL goes where it names, so a step can call a third-party API, in a project with no program too.
|
|
43
|
+
- `context` is the browser context `page` belongs to. `page_as.("aki", { javaScriptEnabled: false })` gives the page of a browser context of its own for the name, so a second person in the scenario keeps cookies of their own. A later call for the name gets the same page. Each step that calls it keeps `trace.aki.zip`, and the scenario ends with `final.aki.png`.
|
|
44
|
+
- `section.("label")` marks a stage the body reached, in the record's `sections`. `poll.(description: "the order", timeout: 30_000, interval: 500) { value or nil }` calls the block until it gives a value, raises `Nukadoko::PollTimeoutError` when the time runs out, and keeps each call in `polls`. `evidence.attach(name, body)` writes a file into the step's own directory, and `evidence.path(name)` gives a path there to write to; the record lists both in `evidence.attachments`. `result_of.(MakeTotal)` reads what an earlier step of the scenario last returned, or nil.
|
|
45
|
+
- `base_url:`, `require_env:`, `page_as:`, and `result_of:` are the snake_case names of `baseURL`, `requireEnv`, `pageAs`, and `resultOf`, so a body passes RuboCop's naming cops. Either name reaches the same fixture. `require_env.("KEY")` raises when the key is missing or empty, and the record lists each key asked for in `required_env`.
|
|
39
46
|
- A Then step declares `claims` and an `observe` that reads the world. nukadoko judges the claims. `observe` does not receive an args key that a claim compares with.
|
|
40
47
|
|
|
41
48
|
## Commands
|
|
@@ -52,9 +59,10 @@ end
|
|
|
52
59
|
- `nuka do <step> [--args <json>] [--use <step-id>]...` runs one step outside any scenario and prints its step record. `--use` fills the step's `from` args from an earlier record, of a `do` or of a run.
|
|
53
60
|
- `nuka scaffold <name> [--pattern <p>] [--then] [--description <text>] [--replace]` writes `features/steps/<name>.rb`, a step whose body raises `not implemented` until someone writes it. `nuka scaffold --feature <path>` writes one for each line no step matches, its pattern read from the line. `--command <entry point>` writes a step that runs the program under Ruby in a scratch directory and returns `exitCode`, `stdout`, and `stderr` (`--cwd <key>` runs it in the directory an args key holds, and `--argv <key>` splits one capture into its arguments). For an executable a gem installs, `bundle binstubs <gem>` writes `bin/<name>`, an entry point `--command` can run. `--request "<METHOD> <path>"` writes a step that sends one request and returns `status` and `body` (`--body <key>` sends that args key). `--from <step>.<key>` fills an args key from an earlier step's returns; with `--then` and one capture, the claim compares the two, so the step needs no edit.
|
|
54
61
|
- Browser launch options go in `nukadoko.config.rb`, as `Nukadoko.config(browser: { executablePath: "..." })`. A step that names `page` gets a browser context of its own for each scenario; each step record holds the requests the page sent and a trace of the step.
|
|
55
|
-
- A step that names `scratch` gets `scratch.dir`, a fresh directory that is removed when the scenario ends, and `scratch.copy(source)`, one that holds a copy of a file or directory of the project. A body that names no `args:` keyword is called without them. `Nukadoko.run_command(command, args, cwd:, env:, input:, timeout:, redact:)` runs a program and returns `{ exitCode:, signal:, stdout:, stderr: }`; the step record lists each run, with each `redact:` value the step holds written as `{{secret.NAME}}`.
|
|
62
|
+
- A step that names `scratch` gets `scratch.dir`, a fresh directory that is removed when the scenario ends, and `scratch.copy(source)`, one that holds a copy of a file or directory of the project. A body that names no `args:` keyword is called without them. `Nukadoko.run_command(command, args, cwd:, env:, input:, timeout:, redact:)` runs a program and returns `{ exitCode:, signal:, stdout:, stderr: }`; the step record lists each run, with each `redact:` value the step holds written as `{{secret.NAME}}`. The program inherits nuka's environment, which under `bundle exec` names nuka's Gemfile; `unbundled: true` runs it with the environment from before Bundler, for a command in another Ruby project such as `bin/rails runner`.
|
|
56
63
|
- `Nukadoko.config(envFiles: [".env"])` loads env files into the `env` fixture, and an environment of the config's `program:` adds its own `envFiles:` after them. A file git does not track, or one that differs from HEAD, is a secret source: each of its values four characters or longer is written as `{{secret.NAME}}` in every step record, `http.jsonl`, and what `nuka do` prints, and what a step prints reaches stderr with them redacted. `secrets: { public: [...], redact: [...] }` keeps one such key plain, or redacts one key of a tracked file. `nuka check` warns about a missing file, a line it skipped, and a `secrets` key no file defines, and never prints a value.
|
|
57
|
-
-
|
|
64
|
+
- `Nukadoko.config(parameterTypes: [{ name: "priority", regexp: /高|低/, transformer: ->(s) { s == "高" ? "high" : "low" } }])` registers a parameter type, as `parameterTypes` does in the TypeScript config, so `{p:priority}` reads a value inside a sentence with no spaces around it. The regexp is a Ruby Regexp or a string, and the transformer, which may be left out, is given the groups the regexp captured. `nuka check` reports a type that takes a built-in name, one no pattern names, and a claim that compares with a capture a transformer rewrote.
|
|
65
|
+
- A project fixture goes in `nukadoko.config.rb`. The block calls `use` with the value, and what follows is the teardown: `Nukadoko.fixture(:store) { |use| use.(Store.new) }`. `scope: :process` keeps one value for the whole run of an environment. A keyword argument names what the fixture needs: another project fixture, or a builtin (such as `page`, `request`, `env`, `requireEnv`, `baseURL`, `scratch`). A fixture with a builtin's name replaces it for every step, and its own `page:` is the builtin, so it can wrap it: `Nukadoko.fixture(:page) { |use, page:| page.set_default_navigation_timeout(10_000); use.(page) }`. `nuka check` refuses a `page` override that names none of `page`, `context`, and `pageAs` (`page-override-unowned`).
|
|
58
66
|
- `parts [CreateTodo, CompleteById]` declares the steps a step may run, and `call.(CreateTodo, title: args.title)` runs one, with its args and returns checked. A part needs no pattern. Each call is kept under `calls` in the calling step's record. `nuka check` reports a cycle in `parts` and a `mutates false` step whose part declares `mutates true`.
|
|
59
67
|
- `poll timeout_ms: 3000` reads `observe` again, 100 ms apart, until every claim holds on two readings in a row or the time runs out. `settled:` names a state that cannot change once reached, so two settled readings in a row stop the wait for a claim that broke. Every reading is kept in the step record.
|
|
60
68
|
- `nuka steps [--json]` lists the vocabulary, and `nuka describe <step>` prints one step with the JSON Schema of its args and returns, in the fields the TypeScript engine prints.
|
data/lib/nukadoko/check.rb
CHANGED
|
@@ -35,7 +35,7 @@ module Nukadoko
|
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
FIXTURES = %w[baseURL call context env evidence page pageAs poll request requireEnv
|
|
38
|
+
FIXTURES = %w[baseURL base_url call context env evidence page pageAs page_as poll request requireEnv require_env resultOf result_of scratch section].freeze
|
|
39
39
|
|
|
40
40
|
class Check
|
|
41
41
|
attr_reader :findings #: Array[Finding]
|
|
@@ -62,6 +62,11 @@ module Nukadoko
|
|
|
62
62
|
%(no .rb step file was found while scanning "features"; no step can ever be registered), Codes.fix("no-step-files-found"), nil)
|
|
63
63
|
end
|
|
64
64
|
@findings.concat(config)
|
|
65
|
+
# The config's parameterTypes did not register, so no pattern binds a
|
|
66
|
+
# line; that is said once, not once per pattern.
|
|
67
|
+
if (collision = Pattern.collision)
|
|
68
|
+
@findings << Finding.new("error", "parameter-type-invalid", nil, nil, nil, collision, Codes.fix("parameter-type-invalid"), nil)
|
|
69
|
+
end
|
|
65
70
|
@usable = steps.reject { definition_broken?(_1) }
|
|
66
71
|
@usable.each { check_contract(_1) }
|
|
67
72
|
check_duplicate_patterns
|
|
@@ -79,6 +84,7 @@ module Nukadoko
|
|
|
79
84
|
if full
|
|
80
85
|
check_unbound
|
|
81
86
|
check_from_unused
|
|
87
|
+
check_unused_parameter_types
|
|
82
88
|
end
|
|
83
89
|
# Errors, then warnings, then notes, each kind in the order found, as
|
|
84
90
|
# the TypeScript engine reports them.
|
|
@@ -137,7 +143,7 @@ module Nukadoko
|
|
|
137
143
|
Pattern.new(pattern)
|
|
138
144
|
nil
|
|
139
145
|
rescue Cucumber::CucumberExpressions::UndefinedParameterTypeError => e
|
|
140
|
-
types = Pattern
|
|
146
|
+
types = Pattern.registry.parameter_types.map(&:name).reject(&:empty?).sort
|
|
141
147
|
["unknown-parameter-type", "#{head}: #{e.message} This project's registered parameter types are: #{types.join(", ")}."]
|
|
142
148
|
rescue StandardError => e
|
|
143
149
|
["pattern-syntax-error", "#{head}: #{e.message}"]
|
|
@@ -224,6 +230,54 @@ module Nukadoko
|
|
|
224
230
|
end
|
|
225
231
|
end
|
|
226
232
|
|
|
233
|
+
# A config parameter type no pattern names.
|
|
234
|
+
#: () -> void
|
|
235
|
+
def check_unused_parameter_types
|
|
236
|
+
used = @steps.flat_map { (pattern = _1.pattern) ? pattern.scan(/\{(?:[^}:]*:)?([^}]*)\}/).flatten : [] }
|
|
237
|
+
(Nukadoko.config_options[:parameterTypes] || []).each do |type|
|
|
238
|
+
name = type[:name].to_s
|
|
239
|
+
next if used.include?(name)
|
|
240
|
+
|
|
241
|
+
findings << Finding.new("note", "parameter-type-unused", CONFIG, nil, nil,
|
|
242
|
+
%(Configured parameter type "#{name}" is not referenced by any typed or compat pattern.), Codes.fix("parameter-type-unused"), nil)
|
|
243
|
+
end
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
# A claim whose expected value is an args key a type with a
|
|
247
|
+
# transformer fills compares with what code made of the line, while
|
|
248
|
+
# the record would name the sentence as its source.
|
|
249
|
+
#: (singleton(Step)) -> void
|
|
250
|
+
def check_transformed(step)
|
|
251
|
+
transformed = Pattern.transformed
|
|
252
|
+
claims = step.claims
|
|
253
|
+
pattern = step.pattern
|
|
254
|
+
return if transformed.empty? || claims.nil? || pattern.nil?
|
|
255
|
+
|
|
256
|
+
keys = {} #: Hash[String, String]
|
|
257
|
+
claims.each_with_index do |claim, index|
|
|
258
|
+
label = "claims[#{index}]"
|
|
259
|
+
each = claim[:each]
|
|
260
|
+
unless each
|
|
261
|
+
keys[claim[:expected].to_s] ||= label if claim[:expected].is_a?(String)
|
|
262
|
+
next
|
|
263
|
+
end
|
|
264
|
+
items = (Array(each[:where]).each_with_index.map { |item, i| ["#{label}.each.where[#{i}]", item] } +
|
|
265
|
+
Array(each[:claims]).each_with_index.map { |item, i| ["#{label}.each.claims[#{i}]", item] }) #: Array[[String, Hash[Symbol, untyped]]]
|
|
266
|
+
items.each { |item_label, item| keys[item[:expected].to_s] ||= item_label if item[:expected].is_a?(String) }
|
|
267
|
+
end
|
|
268
|
+
pattern.scan(Pattern::NAMED).each do |match|
|
|
269
|
+
key, type = Array(match).map(&:to_s)
|
|
270
|
+
label = keys[key.to_s]
|
|
271
|
+
next unless label && transformed.include?(type.to_s)
|
|
272
|
+
|
|
273
|
+
findings << Finding.about_step("error", "claim-expected-transformed", step,
|
|
274
|
+
%(Step "#{step.step_name}"'s #{label}.expected is args.#{key}, and its pattern "#{pattern}" fills it with the parameter type {#{type}}, ) +
|
|
275
|
+
"whose transformer rewrites the line's text before the claim reads it, so code would decide what the claim compares. " \
|
|
276
|
+
"Capture #{key} with a type that has no transformer, such as {#{key}:string}, and read it with expected_view if it needs one",
|
|
277
|
+
Codes.fix("claim-expected-transformed"))
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
|
|
227
281
|
# A from key every line fills with a capture never takes its value
|
|
228
282
|
# from the producer it names.
|
|
229
283
|
#: () -> void
|
|
@@ -272,6 +326,9 @@ module Nukadoko
|
|
|
272
326
|
"Remove or move lines so that exactly one of steps #{quoted} runs before this line.", nil)
|
|
273
327
|
next
|
|
274
328
|
end
|
|
329
|
+
# An optional key may stay empty: the schema says absent is fine.
|
|
330
|
+
next unless step.args.required_names.include?(key)
|
|
331
|
+
|
|
275
332
|
undefined = scenario.steps.first(index).each_index.select { Engine.matches(@usable, scenario.steps[_1].text).empty? }
|
|
276
333
|
issue = { index: index, step: step.step_name, key: key, candidates: names }
|
|
277
334
|
next held << issue.merge(undefined: undefined) if undefined.any?
|
|
@@ -333,7 +390,7 @@ module Nukadoko
|
|
|
333
390
|
"If #{which} is meant to run #{steps_phrase.(held.flat_map { _1[:candidates] }.uniq)}, reword that line to match that step's pattern. Otherwise fix the undefined-step finding first, then run nuka check again: a held-back finding that still applies is reported then.", nil)
|
|
334
391
|
end
|
|
335
392
|
|
|
336
|
-
SCENARIO_ONLY = FIXTURES - %w[env requireEnv baseURL]
|
|
393
|
+
SCENARIO_ONLY = FIXTURES - %w[env requireEnv require_env baseURL base_url]
|
|
337
394
|
|
|
338
395
|
# Fixture definitions that can never resolve, and (in a whole-project
|
|
339
396
|
# check) one no step reaches.
|
|
@@ -362,6 +419,14 @@ module Nukadoko
|
|
|
362
419
|
end
|
|
363
420
|
fixtures.each_key { visit.(_1, []) if state[_1] == :white }
|
|
364
421
|
|
|
422
|
+
# An override of page that names no browser fixture cannot hand back
|
|
423
|
+
# a page the engine launched, records, and traces.
|
|
424
|
+
if (page = fixtures[:page]) && (page.dependencies & %i[page context pageAs page_as]).empty?
|
|
425
|
+
findings << Finding.new("error", "page-override-unowned", config, nil, nil,
|
|
426
|
+
%(fixture "page" overrides the builtin page but destructures none of "page", "context", or "pageAs": there is no way for it to hand back a page the executor still owns and measures),
|
|
427
|
+
Codes.fix("page-override-unowned"), nil)
|
|
428
|
+
end
|
|
429
|
+
|
|
365
430
|
fixtures.each_value do |fixture|
|
|
366
431
|
next unless fixture.scope == :process
|
|
367
432
|
|
|
@@ -551,6 +616,7 @@ module Nukadoko
|
|
|
551
616
|
#: () -> void
|
|
552
617
|
def check_lines
|
|
553
618
|
undefined = []
|
|
619
|
+
bound = [] #: Array[singleton(Step)]
|
|
554
620
|
@scenarios.each do |scenario|
|
|
555
621
|
scenario.steps.each do |line|
|
|
556
622
|
matches = Engine.matches(@usable, line.text)
|
|
@@ -558,6 +624,7 @@ module Nukadoko
|
|
|
558
624
|
when 0 then undefined << [scenario, line]
|
|
559
625
|
when 1
|
|
560
626
|
step, captures = matches.first
|
|
627
|
+
bound << step
|
|
561
628
|
check_fill(scenario, line, step, captures)
|
|
562
629
|
check_position(scenario, line, step)
|
|
563
630
|
check_kinds(scenario, line, step, captures)
|
|
@@ -569,6 +636,7 @@ module Nukadoko
|
|
|
569
636
|
end
|
|
570
637
|
end
|
|
571
638
|
end
|
|
639
|
+
bound.uniq.each { check_transformed(_1) }
|
|
572
640
|
@scenarios.each { check_from_order(_1) }
|
|
573
641
|
@scenarios.each { check_claim_sources(_1) }
|
|
574
642
|
suppress_undefined(undefined)
|
|
@@ -721,7 +789,7 @@ module Nukadoko
|
|
|
721
789
|
# attachment can never be, fail binding with certainty.
|
|
722
790
|
#: (Scenario, PickleStep, singleton(Step), Hash[String, untyped]) -> void
|
|
723
791
|
def check_fill(scenario, line, step, captures)
|
|
724
|
-
missing = step.args.
|
|
792
|
+
missing = step.args.required_names - captures.keys - step.from.keys
|
|
725
793
|
if line.table || line.doc_string
|
|
726
794
|
if missing.size != 1
|
|
727
795
|
detail = missing.empty? ? "every args key is already consumed by named captures or declared from" : "#{missing.size} args keys are left unconsumed (#{missing.join(", ")}); exactly one is required"
|
|
@@ -776,7 +844,7 @@ module Nukadoko
|
|
|
776
844
|
#: (Scenario, PickleStep, singleton(Step), Hash[String, untyped]) -> void
|
|
777
845
|
def check_unfit_trees(scenario, line, step, captures)
|
|
778
846
|
claims = step.claims or return
|
|
779
|
-
docstring_keys = line.doc_string ? step.args.
|
|
847
|
+
docstring_keys = line.doc_string ? step.args.required_names - captures.keys - step.from.keys.map(&:to_s) : []
|
|
780
848
|
claims.each_with_index do |claim, index|
|
|
781
849
|
key = claim[:expected]
|
|
782
850
|
next if claim[:each] || claim[:compare] != "fits-aria-snapshot" || !key.is_a?(String)
|
data/lib/nukadoko/claim_sides.rb
CHANGED
|
@@ -41,8 +41,18 @@ module Nukadoko
|
|
|
41
41
|
:from_keys, #: Array[String]
|
|
42
42
|
:labels, #: ^(String) -> String
|
|
43
43
|
:received, #: Array[String]
|
|
44
|
+
# Why a claim cannot compare with an args key, for each key the
|
|
45
|
+
# matched pattern fills with a parameter type that has a transformer.
|
|
46
|
+
:transformed, #: Hash[String, String]
|
|
44
47
|
)
|
|
45
48
|
|
|
49
|
+
# A Data block's methods are its own, but rbs-inline reads only a class
|
|
50
|
+
# body, so they are written in one.
|
|
51
|
+
class Inputs
|
|
52
|
+
#: (?transformed: Hash[String, String], **untyped) -> void
|
|
53
|
+
def initialize(transformed: {}, **rest) = super
|
|
54
|
+
end
|
|
55
|
+
|
|
46
56
|
#: (Place, String?) -> Place
|
|
47
57
|
def self.place_at(place, path)
|
|
48
58
|
return place if path.nil? || path.empty?
|
|
@@ -300,6 +310,8 @@ module Nukadoko
|
|
|
300
310
|
def self.expected_side(claim, inputs)
|
|
301
311
|
name = ->(place) { "the expected value #{place.label}" }
|
|
302
312
|
case claim[:expected]
|
|
313
|
+
in String => key if (reason = inputs.transformed[key])
|
|
314
|
+
[Side.new(place: arg_place(key, inputs), found: { unjudged: reason }), false]
|
|
303
315
|
in String => key then [shaped(arg_side([key], inputs, name), claim[:expected_view], nil), false]
|
|
304
316
|
in { from: String => key } then [arg_side(segments(key), inputs, name), false]
|
|
305
317
|
in { observe: String => path } then [side_of(read_at(inputs.observed, segments(path)), OBSERVE, segments(path), 0, name), true]
|
data/lib/nukadoko/cli.rb
CHANGED
|
@@ -270,6 +270,14 @@ module Nukadoko
|
|
|
270
270
|
stop = { severity: "refused", code: failed.code, message: "#{failed.file}: #{failed.message}", fix: failed.fix, do: "nuka check" }
|
|
271
271
|
return finish("run", false, findings: [stop], verdict: "refused", exit_code: 2)
|
|
272
272
|
end
|
|
273
|
+
# The TypeScript engine builds its bindings before any scenario starts,
|
|
274
|
+
# so parameter types that do not register stop a run under --no-check
|
|
275
|
+
# too.
|
|
276
|
+
if @no_check && (collision = Engine::Pattern.collision)
|
|
277
|
+
stop = { severity: "refused", code: "parameter-type-collision", message: collision,
|
|
278
|
+
fix: "Rename the parameter type, or remove one of the two registrations.", do: "nuka run --help" }
|
|
279
|
+
return finish("run", false, findings: [stop], verdict: "refused", exit_code: 2)
|
|
280
|
+
end
|
|
273
281
|
# Only the check's errors hold a run back, so only they are reported.
|
|
274
282
|
findings = @no_check ? [] : check.findings.map { relative(_1).to_h }.select { _1[:severity] == "error" }
|
|
275
283
|
unless @no_check || check.passed?
|
|
@@ -435,7 +443,7 @@ module Nukadoko
|
|
|
435
443
|
return refuse(Engine::Refusal.new("step-args-invalid", "--args must be a JSON object", fix: args_fix, run: describe)) unless given.is_a?(Hash)
|
|
436
444
|
end
|
|
437
445
|
args, origins, used = used_args(step, @options["--use"])
|
|
438
|
-
if @options["--args"].empty? && (step.args.
|
|
446
|
+
if @options["--args"].empty? && (step.args.required_names - args.keys).any?
|
|
439
447
|
return refuse(Engine::Refusal.new("step-args-invalid", "--args is required unless --use supplies this step's arguments", fix: args_fix, run: describe))
|
|
440
448
|
end
|
|
441
449
|
|
data/lib/nukadoko/command.rb
CHANGED
|
@@ -21,8 +21,11 @@ module Nukadoko
|
|
|
21
21
|
# no exit code to read. `input` (or `stdin`) is written to the program's
|
|
22
22
|
# stdin. `redact` names secrets the step holds itself, which the record
|
|
23
23
|
# writes as `{{secret.NAME}}` while the program still gets the real value.
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
# `unbundled: true` runs the command with the environment from before
|
|
25
|
+
# Bundler set up nuka (no BUNDLE_GEMFILE, no -rbundler/setup in RUBYOPT),
|
|
26
|
+
# for a command in another Ruby project, which has a Gemfile of its own.
|
|
27
|
+
#: (String, ?Array[String], ?cwd: String, ?env: Hash[String | Symbol, String], ?input: String?, ?stdin: String?, ?timeout: Numeric?, ?redact: Hash[String | Symbol, String], ?files: bool, ?unbundled: bool) -> Hash[Symbol, untyped]
|
|
28
|
+
def self.run_command(command, args = [], cwd: Dir.pwd, env: {}, input: nil, stdin: nil, timeout: nil, redact: {}, files: false, unbundled: false)
|
|
26
29
|
stdin = input.nil? ? stdin : input
|
|
27
30
|
held = Engine::Secrets.new(redact.to_h { |name, value| [name.to_s, value.to_s] })
|
|
28
31
|
recording = Engine::Processes.current
|
|
@@ -33,6 +36,7 @@ module Nukadoko
|
|
|
33
36
|
traceparent = (Engine::Trace.current&.process_traceparent unless env.key?("TRACEPARENT"))
|
|
34
37
|
chosen = env
|
|
35
38
|
env = env.merge("TRACEPARENT" => traceparent) if traceparent
|
|
39
|
+
env = Engine::Processes.unbundled(env) if unbundled
|
|
36
40
|
before = Engine::FileWalk.snapshot(cwd) if recording || files
|
|
37
41
|
started = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
38
42
|
# A group of its own, so its close tells whether anything it started still runs.
|
|
@@ -70,12 +74,26 @@ module Nukadoko
|
|
|
70
74
|
#: () -> bool
|
|
71
75
|
def self.groups? = !Gem.win_platform?
|
|
72
76
|
|
|
77
|
+
# `env` on top of the environment Bundler found when it set up nuka:
|
|
78
|
+
# each variable Bundler added is unset and each one it changed is put
|
|
79
|
+
# back. Without Bundler loaded there is nothing to undo.
|
|
80
|
+
#: (Hash[String, String?]) -> Hash[String, String?]
|
|
81
|
+
def self.unbundled(env)
|
|
82
|
+
return env unless defined?(::Bundler) && ::Bundler.respond_to?(:unbundled_env)
|
|
83
|
+
|
|
84
|
+
original = ::Bundler.unbundled_env
|
|
85
|
+
added = (ENV.keys - original.keys).to_h { [_1, nil] }
|
|
86
|
+
changed = original.reject { |key, value| ENV[key] == value }
|
|
87
|
+
added.merge(changed).merge(env)
|
|
88
|
+
end
|
|
89
|
+
|
|
73
90
|
# Runs the command to its close, its stdin closed after `input`.
|
|
74
|
-
#: (Hash[String, String], Array[String], String, String?, Numeric?, group: bool) -> [String, String, Process::Status, bool?]
|
|
91
|
+
#: (Hash[String, String?], Array[String], String, String?, Numeric?, group: bool) -> [String, String, Process::Status, bool?]
|
|
75
92
|
def self.spawn(env, argv, cwd, input, timeout, group:)
|
|
76
93
|
options = { chdir: cwd } #: Hash[Symbol, untyped]
|
|
77
94
|
options[:pgroup] = true if group && groups?
|
|
78
|
-
|
|
95
|
+
# A nil value unsets the variable, which Open3's signature leaves out.
|
|
96
|
+
Open3.popen3(_ = env, *argv, **options) do |stdin, out, err, thread|
|
|
79
97
|
stdin.write(input.to_s)
|
|
80
98
|
stdin.close
|
|
81
99
|
readers = [Thread.new { out.read }, Thread.new { err.read }]
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# rbs_inline: enabled
|
|
3
|
+
|
|
4
|
+
# Where a step's own code raised, as the project's own frames of the
|
|
5
|
+
# backtrace. A step record's error message says what went wrong but not
|
|
6
|
+
# where, so a reader had to call the step again outside nukadoko to find the
|
|
7
|
+
# line. The frames kept are the ones a reader can open and change: inside
|
|
8
|
+
# the project root, and outside the gem and any installed bundle, as the
|
|
9
|
+
# TypeScript engine leaves out node_modules.
|
|
10
|
+
module Nukadoko
|
|
11
|
+
module Engine
|
|
12
|
+
module ErrorFrames
|
|
13
|
+
# The first few frames are where the code was when it raised; the rest
|
|
14
|
+
# is the call chain a reader rarely needs.
|
|
15
|
+
MAX = 5
|
|
16
|
+
GEM_ROOT = File.expand_path("../..", __dir__.to_s)
|
|
17
|
+
|
|
18
|
+
module_function
|
|
19
|
+
|
|
20
|
+
# Each frame as `path:line` relative to `root`, in backtrace order,
|
|
21
|
+
# without repeats.
|
|
22
|
+
#: (Exception, String) -> Array[String]
|
|
23
|
+
def of(error, root)
|
|
24
|
+
# A root under a symlink (macOS /var) names files by either spelling.
|
|
25
|
+
roots = [File.expand_path(root), (File.realpath(root) rescue nil)].compact.uniq
|
|
26
|
+
frames = [] #: Array[String]
|
|
27
|
+
(error.backtrace_locations || []).each do |location|
|
|
28
|
+
file = location.absolute_path || location.path
|
|
29
|
+
next unless file && File.absolute_path?(file)
|
|
30
|
+
base = roots.find { file.start_with?("#{_1}/") }
|
|
31
|
+
next if file.start_with?("#{GEM_ROOT}/") || base.nil?
|
|
32
|
+
|
|
33
|
+
relative = file.delete_prefix("#{base}/")
|
|
34
|
+
next if relative.split("/").include?("vendor") && relative.include?("/bundle/")
|
|
35
|
+
|
|
36
|
+
frame = "#{relative}:#{location.lineno}"
|
|
37
|
+
frames << frame unless frames.include?(frame)
|
|
38
|
+
break if frames.size == MAX
|
|
39
|
+
end
|
|
40
|
+
frames
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
data/lib/nukadoko/features.rb
CHANGED
|
@@ -96,7 +96,9 @@ module Nukadoko
|
|
|
96
96
|
def self.collect_lines(node, lines, background, headers, names)
|
|
97
97
|
node.tags&.each { lines[_1.id] = _1.location.line }
|
|
98
98
|
node.children.each do |child|
|
|
99
|
-
|
|
99
|
+
# A rule's own children are RuleChild values, which hold a background or
|
|
100
|
+
# a scenario and never another rule.
|
|
101
|
+
next collect_lines(child.rule, lines, background, headers, names) if child.respond_to?(:rule) && child.rule
|
|
100
102
|
|
|
101
103
|
scenario = child.scenario || child.background
|
|
102
104
|
next unless scenario
|