gherkin-ast

JS model for Gherkin feature files

Usage no npm install needed!

<script type="module">
  import gherkinAst from 'https://cdn.skypack.dev/gherkin-ast';
</script>

README

gherkin-ast

Downloads Version@npm Version@git CI Docs

Models for Gherkin feature files

AST

The API provides types to be able to handle different parts of Gherkin feature files.

In TypeScript:

import {Feature, Scenario /*, Background, ... */} from "gherkin-ast";

OR in JavaScript:

const {Feature, Scenario /*, Background, ... */} = require("gherkin-ast");
const feature = new Feature("Feature", "Displaying documents");
feature.elements.push(new Scenario("Scenario", "Opening a document"));
// ...

For detailed documentation see the TypeDocs documentation.

This package uses debug for logging.

NOTE parse functions only support AST provided by the parser of gherkin@6.