Add option to include contextual information in code fragments #39
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When a scenario is imported to Testomatio, the corresponding source code from the
*.feature
file is also uploaded. However, seeing just the scenarios code might not be sufficient or even misleading. Most importantly, there is currently no way to see the steps of aBackground
section on Testomatio.This PR adds CLI flags to include the source code of relevant
Background
sections as well as the names, descriptions and tags of parent features and rules.$> npx check-cucumber --help ... --include-features Add description of feature to scenario code --include-rules Add description of parent rule sections to scenario code --include-backgrounds Add description and steps of relevant background sections to scenario code
For example, when all three CLI flags are set, the tool will now extract the following code fragment for "Scenario 2.2" from
example/features/rules.feature
:This PR depends on the support for rules added in #38. The
getLocations
function added in #38 is also reused to extract the correct source code fragments for features, rules and backgrounds. The main change is the implementation of a new handler for theBackground
keyword ingetSourceCode
and the addition of acontext
variable to keep track of the source code of rules and backgrounds.