Skip to content

Parse Cucumber JSON from most Cucumber implementations and versions

License

Notifications You must be signed in to change notification settings

cucumber/cucumber-json-converter

Repository files navigation

Cucumber JSON Converter

This library converts Cucumber JSON from multiple implementations and versions into a JavaScript object with a strict schema.

Usage

import { convert } from '@cucumber/cucumber-json-converter'

const ob = JSON.parse(jsonFromAnyCucumberImplementation)
const cucumberJsonObject = convert(ob)

The convert function will throw an error if it fails to recognize the object as a valid Cucumber JSON object.

Motivation

The "Cucumber JSON" format was created several years before the JSON Schema standard started gaining traction. The lack of a formal schema led to inconsistencies between different Cucumber implementations and releases.

This library contains JSON Schemas for multiple implementations and versions of Cucumber. These schemas have been retrofitted to match the actual output of these implementations.