Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support: add ability to name hooks (#1994)
* update compatibility kit * add failing feature test * add failing type test * add name to object * enough to make cck pass * update formatter stuff so feature test passes * fix this test * add doco * more feature file text * Update CHANGELOG.md * Update CHANGELOG.md * tweak documentation * update html-formatter dep Co-authored-by: Aurélien Reeves <aurelien.reeves@smartbear.com>
- Loading branch information
1 parent
dfb3f79
commit c45330a
Showing
14 changed files
with
109 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
Feature: Named hooks | ||
|
||
As a developer | ||
I want to name a `Before` or `After` hook | ||
So that I can easily identify which hooks are run when reporting | ||
|
||
Scenario: Hook is named and then referenced by its name in formatter output | ||
Given a file named "features/a.feature" with: | ||
""" | ||
Feature: some feature | ||
Scenario: some scenario | ||
Given a step | ||
""" | ||
And a file named "features/step_definitions/hooks.js" with: | ||
""" | ||
const {After, Before} = require('@cucumber/cucumber') | ||
Before({name: 'hook 1'}, function() {}) | ||
Before({name: 'hook 2'}, function() {}) | ||
After({name: 'hook 3'}, function() {}) | ||
""" | ||
And a file named "features/step_definitions/steps.js" with: | ||
""" | ||
const {Given} = require('@cucumber/cucumber') | ||
Given('a step', function() { | ||
throw 'nope' | ||
}) | ||
""" | ||
When I run cucumber-js | ||
Then it fails | ||
And the output contains the text: | ||
""" | ||
Before (hook 2) # | ||
""" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters