Skip to content

test: Migrate ParserTest fixtures to the cucumber gherkin testdata format - #427

Open
Amoifr wants to merge 1 commit into
Behat:masterfrom
Amoifr:migrate-parser-fixtures-testdata
Open

test: Migrate ParserTest fixtures to the cucumber gherkin testdata format#427
Amoifr wants to merge 1 commit into
Behat:masterfrom
Amoifr:migrate-parser-fixtures-testdata

Conversation

@Amoifr

@Amoifr Amoifr commented Aug 19, 2026

Copy link
Copy Markdown

Closes #389.

This converts all 34 ParserTest fixture pairs (tests/Fixtures/features/*.feature + tests/Fixtures/etalons/*.yml) to the cucumber gherkin testdata format in tests/Cucumber/extra_testdata/good/, following the approach of #322:

  • the .ast.ndjson expectations were generated with the official cucumber gherkin-javascript CLI (--predictable-ids --no-source --no-pickles, piped through jq --sort-keys -c to match the existing file format), so they are real cucumber parser output, not dumps of our own parser;
  • the official parser accepts every one of the 34 features, so they all live in good/;
  • two fixtures collided with upstream testdata names and were renamed after what they actually test: background.feature -> background_and_untitled_scenario.feature and empty.feature -> comment_without_trailing_newline.feature;
  • 7 fixtures parse differently in legacy mode only (zero divergence in gherkin-32): multiline titles folded into the title (5) and trailing whitespace trimmed from description lines (2). They are documented in $notParsingCorrectly and their expected_variants were recorded with RE_RECORD_EXPECTATIONS; I checked the recorded variants against the old YAML etalons, the semantics are identical.

Each fixture is now exercised in both compatibility modes instead of one, and the previously etalon-covered behaviour is protected either by the cucumber expectations or by the recorded variants.

The loader tests used to share the fixtures folder, so they now have their own minimal tests/Loader/Fixtures/ (three features and the addition.yml etalon they assert against). With that, tests/Fixtures/features and tests/Fixtures/etalons are gone and ParserTest no longer uses YamlFileLoader at all, which unblocks #362.

Note: PHPStan currently reports a pre-existing offsetAccess.invalidOffset on src/Node/TableNode.php:156 that is unrelated to this change (master has not been rebuilt since the gherkin v40 / dependency bumps); happy to address it separately if useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate all ParserTest fixtures to the gherkin testdata format

1 participant