Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hdorgeval/cucumber6-static-usage
Static steps usage reporter for cucumber-js v6
https://github.com/hdorgeval/cucumber6-static-usage
cucumber cucumber-js cucumberjs-v6 custom-formatter reporter steps-usage usage
Last synced: 27 days ago
JSON representation
Static steps usage reporter for cucumber-js v6
- Host: GitHub
- URL: https://github.com/hdorgeval/cucumber6-static-usage
- Owner: hdorgeval
- License: mit
- Created: 2021-07-23T17:23:03.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-07-27T20:16:42.000Z (over 3 years ago)
- Last Synced: 2024-10-18T08:37:13.623Z (3 months ago)
- Topics: cucumber, cucumber-js, cucumberjs-v6, custom-formatter, reporter, steps-usage, usage
- Language: TypeScript
- Homepage:
- Size: 186 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# cucumber6-static-usage
[![npm version](https://img.shields.io/npm/v/cucumber6-static-usage.svg)](https://www.npmjs.com/package/cucumber6-static-usage)
Static steps usage reporter for cucumber-js v6.
This reporter is inspired by the built-in `usage` reporter without limiting the matches to the first five:
this reporter gives you the usage for all steps without any limitation, so the generated report might be huge.## To install this steps usage reporter
- run the command:
```sh
npm install --save cucumber6-static-usage
```## Usage
- add to the cucumber-js command-line the following option:
```sh
--format node_modules/cucumber6-static-usage:steps-usage.txt --dry-run
```You should run `cucumber-js` in dry mode, because this reporter does not handle test execution results and durations.
## What it generates
Here is a sample that corresponds to this feature file:
`simple-maths.feature`:
```gherkin
@foo
Feature: Simple maths
In order to do maths
As a developer
I want to increment variablesBackground: Calculator
Given I have a simple maths calculatorScenario: easy maths
Given a variable is set to 11
When I increment this variable by 1
Then the variable should contain 12
When I increment this variable by 2
Then the variable should contain 14
When I increment this variable by 2
Then the variable should contain 16Scenario Outline: much more complex stuff
Given a variable is set to
When I increment this variable by
When I increment this variable by 2
Then the variable should contain
Examples:
| var | increment | result |
| 100 | 5 | 105 |
| 99 | 1234 | 1333 |
| 12 | 5 | 17 |```
`steps-usage.txt`:
```txt
┌────────────────────────────────────────────┬────────┬─────────────────────────────────────────────────┐
│ Pattern / Text │ Usage │ Location │
├────────────────────────────────────────────┼────────┼─────────────────────────────────────────────────┤
│ I have a simple maths calculator │ - │ step-definitions/maths/simple-maths-steps.ts:5 │
│ I have a simple maths calculator │ - │ features/simple-maths.feature:8 │
├────────────────────────────────────────────┼────────┼─────────────────────────────────────────────────┤
│ a variable is set to {int} │ - │ step-definitions/maths/simple-maths-steps.ts:9 │
│ a variable is set to 11 │ - │ features/simple-maths.feature:11 │
│ a variable is set to │ - │ features/simple-maths.feature:20 │
├────────────────────────────────────────────┼────────┼─────────────────────────────────────────────────┤
│ I increment this variable by {int} │ - │ step-definitions/maths/simple-maths-steps.ts:13 │
│ I increment this variable by 1 │ - │ features/simple-maths.feature:12 │
│ I increment this variable by 2 │ - │ features/simple-maths.feature:14 │
│ I increment this variable by 2 │ - │ features/simple-maths.feature:16 │
│ I increment this variable by 2 │ - │ features/simple-maths.feature:22 │
│ I increment this variable by │ - │ features/simple-maths.feature:21 │
├────────────────────────────────────────────┼────────┼─────────────────────────────────────────────────┤
│ I foobar this variable by {int} │ UNUSED │ step-definitions/maths/simple-maths-steps.ts:17 │
├────────────────────────────────────────────┼────────┼─────────────────────────────────────────────────┤
│ the variable should contain {int} │ - │ step-definitions/maths/simple-maths-steps.ts:21 │
│ the variable should contain 12 │ - │ features/simple-maths.feature:13 │
│ the variable should contain 14 │ - │ features/simple-maths.feature:15 │
│ the variable should contain 16 │ - │ features/simple-maths.feature:17 │
│ the variable should contain │ - │ features/simple-maths.feature:23 │
└────────────────────────────────────────────┴────────┴─────────────────────────────────────────────────┘```
## Control the size of the first column of the generated report
The reporter tries to infer a 'best' width for the first column of the report.
In some cases this value may not fit your needs; you can control the width of the first column by setting the environment variable `STEPS_USAGE_REPORT_FIRST_COL_WIDTH`:
```js
process.env['STEPS_USAGE_REPORT_FIRST_COL_WIDTH'] = 150;
```