Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass scenario argument to hooks. Fixes #891 #905

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions features/hook_interface.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,26 @@ Feature: After hook interface
})
"""

Scenario Outline: scenario hook parameter
Given a file named "features/support/hooks.js" with:
"""
import {<TYPE>} from 'cucumber'

<TYPE>(function(scenario) {
throw new Error('STATUS: ' + scenario.status)
})
"""
When I run cucumber.js
Then it fails
And the output contains the text:
"""
STATUS: passed
"""
Examples:
| TYPE |
| Before |
| After |

Scenario Outline: too many arguments
Given a file named "features/support/hooks.js" with:
"""
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/test_case_runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export default class TestCaseRunner {
invokeStep(step, stepDefinition) {
return StepRunner.run({
defaultTimeout: this.supportCodeLibrary.defaultTimeout,
scenarioResult: this.scenarioResult,
scenarioResult: this.result,
step,
stepDefinition,
parameterTypeRegistry: this.supportCodeLibrary.parameterTypeRegistry,
Expand Down