DavertMik · GitHub

DavertMik @claude

Adds three layers of coverage for the bug fixed in  770749e  (gherkin
beforeEach/afterEach emitting event.test.before with a placeholder test
when the hook Context lacked .ctx.currentTest):
* Unit (test/unit/bdd_test.js): six tests in a new "Gherkin hook events"
  block that drive the codeceptjs.before/after hooks with a mock Mocha
  Context and assert the real scenario title and tags reach
  event.test.before, event.test.after, the Before/After step-definition
  hooks, and that done is forwarded.
* Runner (test/runner/bdd_test.js + test/data/sandbox): a capture plugin
  and codecept.bdd.events.js config that serialize event payloads to a
  temp JSON file so a spawned runner asserts the real @important/@very
  tags reach listeners end-to-end.
* Acceptance (test/acceptance/gherkin/before_hook.feature + steps.js):
  a new Background+tagged feature whose Then step verifies both the BDD
  Before() hook and a direct event.test.before listener captured the
  real scenario.
Also flips setup/teardown to prefer suite.ctx.currentTest over
suite.currentTest, restoring the regular Scenario path while keeping the
BDD fallback.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Read the original on github.com ↗