Contents

usage json formatter

As a developer I want a formatter which just outputs the full step definition usage in a parsable format So I can feed the usage data to other programs

Scenario:

  • Given a file named "features/a.feature" with:
    gherkin
    Feature: a feature
      Scenario: a scenario
        Given step A
        And step A
        When step B
        Then step C
  • And a file named "features/step_definitions/steps.js" with:
    ruby
    const {When} = require('@cucumber/cucumber')
    
    When('step A', function() {});
    When('step B', function() {});
    When('step C', function() {});
    When(/step D/, function() {});
  • When I run cucumber-js with `--format usage-json`
  • Then it outputs the usage data:
    PATTERNPATTERN_TYPEURILINENUMBER OF MATCHES
    step ACucumberExpressionfeatures/step_definitions/steps.js32
    step BCucumberExpressionfeatures/step_definitions/steps.js41
    step CCucumberExpressionfeatures/step_definitions/steps.js51
    step DRegularExpressionfeatures/step_definitions/steps.js60

Source: features/usage_json_formatter.feature at commit 3ac6ecda, Cucumber Js (MIT license).