Skip to content

arckit-dev/cucumber

Repository files navigation

@arckit/cucumber

Cucumber.js testing utilities for BDD step definitions.

npm version npm downloads bundle size codecov TypeScript Cucumber

📑 Table of Contents

🪧 About

DataTable assertion helper for Cucumber.js step definitions. Supports nested property access via dot notation and array indexing.

📦 Installation

pnpm add -D @arckit/cucumber

🚀 Usage

import { assertMatchesDataTable } from '@arckit/cucumber';

Then(/^I should see the client$/, (dataTable: DataTable) => {
  assertMatchesDataTable(dataTable)(client);
});

With a DataTable like:

| Field                | Value              |
| name.firstname       | Jean               |
| name.lastname        | Dupont             |
| address.street       | 123 Rue de la Paix |
| address.zipcode      | 75001              |
| lines[0].label       | Prestation         |

📖 API

assertMatchesDataTable(dataTable: DataTable) => (actual: unknown, options?: { message?: string }) => void

Parameter Description
dataTable A Cucumber DataTable with two columns: field path and expected value
actual The object to assert against
options.message Optional custom error message if the object is undefined

Field paths support dot notation (name.firstname) and bracket notation for arrays (lines[0].label). Values are compared as strings using deepStrictEqual.

🤗 Contributing

See CONTRIBUTING.md for details.

📝 License

MIT © Marc Gavanier

About

Cucumber.js testing utilities for step definitions

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors