-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
format: add support for gherkin rule/example syntax (#1273)
* add basic feature for gherkin rule/example support * use require instead of import * assert on formatter output for passing example * add formatters.feature scenario for rejected pickle from rule * add formatters.feature scenario for passed from rule * add editorconfig for indentation control * formatting * make `getGherkinStepMap` rule-aware * restructure tests a bit * refactor tests a bit more, add some to cover getGherkinScenarioMap * account for Rule in getGherkinScenarioMap * rework getGherkinScenarioLocationMap to handle Rule * add unit test for Rule/Example in json formatter * report keyword as Scenario or Example correctly from scenario map * include rule name in concatenated scenario id for json formatter * make sure we work with a background within a rule * readability * add background usage to rule feature, assert on failure output * add acceptance test for message and json format on failure from rule * add a bit of coverage for the progress bar formatter * more on progress far - numbers/time reporting at end * work rule usage into progress formatter spec * work rule usage into rerun formatter spec * work rule usage into summary formatter spec * add coverage for pickle filtering on name * changelog update * rework progress formatter spec to have a seperate case for rule/example * remove negative test for rule/example in json formatter * rework gherkin document parser spec to avoid replication of structure * fix some lint * fix line numbers in formatter unit tests * fix dodgy import * fix overqualified references to messages interfaces * remove unnecessary tags * for progress bar formatter, break out new test for rule/example, retain scenario one * split out new test for rule/example in rerun formatter spec * remove superfluous formatter tests * fix whitespace * restore original names where qualifiers no longer needed
- Loading branch information
1 parent
0bbb4b9
commit bf23ac9
Showing
19 changed files
with
1,139 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# 4 space indentation | ||
[*] | ||
indent_style = space | ||
indent_size = 2 |
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,37 @@ | ||
module.exports = [ | ||
{ | ||
description: '', | ||
elements: [ | ||
{ | ||
description: '', | ||
id: 'a-feature;a-rule;an-example', | ||
keyword: 'Example', | ||
line: 3, | ||
name: 'an example', | ||
steps: [ | ||
{ | ||
arguments: [], | ||
keyword: 'Given ', | ||
line: 4, | ||
match: { | ||
location: 'features/step_definitions/steps.js:3', | ||
}, | ||
name: 'a step', | ||
result: { | ||
duration: 0, | ||
status: 'passed', | ||
}, | ||
}, | ||
], | ||
tags: [], | ||
type: 'scenario', | ||
}, | ||
], | ||
id: 'a-feature', | ||
keyword: 'Feature', | ||
line: 1, | ||
name: 'a feature', | ||
tags: [], | ||
uri: 'features/a.feature', | ||
}, | ||
] |
143 changes: 143 additions & 0 deletions
143
features/fixtures/formatters/passed-rule.message.json.ts
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,143 @@ | ||
module.exports = [ | ||
{ | ||
source: { | ||
uri: 'features/a.feature', | ||
data: | ||
'Feature: a feature\n Rule: a rule\n Example: an example\n Given a step', | ||
media: { | ||
encoding: 'UTF8', | ||
contentType: 'text/x.cucumber.gherkin+plain', | ||
}, | ||
}, | ||
}, | ||
{ | ||
gherkinDocument: { | ||
uri: 'features/a.feature', | ||
feature: { | ||
location: { | ||
line: 1, | ||
column: 1, | ||
}, | ||
language: 'en', | ||
keyword: 'Feature', | ||
name: 'a feature', | ||
children: [ | ||
{ | ||
rule: { | ||
location: { | ||
line: 2, | ||
column: 3, | ||
}, | ||
keyword: 'Rule', | ||
name: 'a rule', | ||
children: [ | ||
{ | ||
scenario: { | ||
location: { | ||
line: 3, | ||
column: 5, | ||
}, | ||
keyword: 'Example', | ||
name: 'an example', | ||
steps: [ | ||
{ | ||
location: { | ||
line: 4, | ||
column: 7, | ||
}, | ||
keyword: 'Given ', | ||
text: 'a step', | ||
id: '1', | ||
}, | ||
], | ||
id: '2', | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
{ | ||
pickle: { | ||
id: '4', | ||
uri: 'features/a.feature', | ||
name: 'an example', | ||
language: 'en', | ||
steps: [ | ||
{ | ||
text: 'a step', | ||
id: '3', | ||
astNodeIds: ['1'], | ||
}, | ||
], | ||
astNodeIds: ['2'], | ||
}, | ||
}, | ||
{ | ||
pickleAccepted: { | ||
pickleId: '4', | ||
}, | ||
}, | ||
{ | ||
testRunStarted: {}, | ||
}, | ||
{ | ||
testCase: { | ||
id: '5', | ||
pickleId: '4', | ||
testSteps: [ | ||
{ | ||
id: '6', | ||
pickleStepId: '3', | ||
stepDefinitionIds: ['0'], | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
testCaseStarted: { | ||
attempt: 0, | ||
testCaseId: '5', | ||
id: '7', | ||
}, | ||
}, | ||
{ | ||
testStepStarted: { | ||
testStepId: '6', | ||
testCaseStartedId: '7', | ||
}, | ||
}, | ||
{ | ||
testStepFinished: { | ||
testResult: { | ||
status: 'PASSED', | ||
duration: { | ||
seconds: '0', | ||
nanos: 0, | ||
}, | ||
}, | ||
testStepId: '6', | ||
testCaseStartedId: '7', | ||
}, | ||
}, | ||
{ | ||
testCaseFinished: { | ||
testResult: { | ||
status: 'PASSED', | ||
duration: { | ||
seconds: '0', | ||
nanos: 0, | ||
}, | ||
}, | ||
testCaseStartedId: '7', | ||
}, | ||
}, | ||
{ | ||
testRunFinished: { | ||
success: true, | ||
}, | ||
}, | ||
] |
File renamed without changes.
File renamed without changes.
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
Oops, something went wrong.