JS model for Gherkin feature files

Usage no npm install needed!

<script type="module">
  import gherkinAst from '';



Downloads Version@npm Version@git CI Docs

Models for Gherkin feature files


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.