Skip to content

fix(gherkin): emit test.before/after with real current test#5580

Open
danikkrapivnitskiy wants to merge 1 commit into
codeceptjs:4.xfrom
danikkrapivnitskiy:fix/bdd-gherkin-test-before-current-test
Open

fix(gherkin): emit test.before/after with real current test#5580
danikkrapivnitskiy wants to merge 1 commit into
codeceptjs:4.xfrom
danikkrapivnitskiy:fix/bdd-gherkin-test-before-current-test

Conversation

@danikkrapivnitskiy
Copy link
Copy Markdown

Gherkin beforeEach/afterEach pass Mocha hook Context into setup/teardown, but asyncWrapper read suite.ctx.currentTest (undefined on Context), so event.test.before received a placeholder test (title "...", empty tags).

Also forward Mocha's done callback instead of no-op () => {}, so event.test.before completes before scenario Background Before hooks run.

Motivation/Description of the PR

  • Description of this PR, which problem it solves
  • Resolves #issueId (if applicable).

Applicable helpers:

  • Playwright
  • Puppeteer
  • WebDriver
  • REST
  • FileHelper
  • Appium

Applicable plugins:

  • aiTrace
  • autoDelay
  • autoLogin
  • customLocator
  • pause
  • coverage
  • heal
  • retryFailedStep
  • screenshot
  • selenoid
  • stepTimeout
  • subtitles

Type of change

  • 🔥 Breaking changes
  • 🚀 New functionality
  • 🐛 Bug fix
  • 🧹 Chore
  • 📋 Documentation changes/updates
  • ♨️ Hot fix
  • 🔨 Markdown files fix - not related to source code
  • 💅 Polish code

Checklist:

  • Tests have been added
  • Documentation has been added (Run npm run docs)
  • Lint checking (Run npm run lint)
  • Local tests are passed (Run npm test)

Gherkin beforeEach/afterEach pass Mocha hook Context into setup/teardown,
but asyncWrapper read suite.ctx.currentTest (undefined on Context), so
event.test.before received a placeholder test (title "...", empty tags).

Also forward Mocha's done callback instead of no-op () => {}, so
event.test.before completes before scenario Background Before hooks run.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

2 participants