npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

feat2test

v2.2.0

Published

Turn Gherkin Features into deterministic tests for Vitest or node:test.

Readme

feat2test

Turn Gherkin Features into deterministic TypeScript tests and editable Step Adapters.

Usage

Requires Node.js 22.18+.

npx feat2test generate features test/features --runner vitest
npx vitest run

The input can be a .feature file, a .feature.md file, or a directory. Directories are traversed recursively, and their structure is preserved in the output directory.

feat2test generate <feature> <output> --runner <vitest|node:test> [--check]

Options:

  • -r, --runner: required test runner.
  • --check: validates without writing; fails if the test or Step Adapter is missing or out of date.
  • --debug: includes the stack trace.
  • --help, --version: displays help or version information.

Exit codes: 0 success, 1 Feature/generation/check error, 2 invalid usage or runner.

Runners

| Runner | Requirement | Adapter import | | --- | --- | --- | | vitest | Vitest installed in the project | *.steps.js | | node:test | Node.js, with no additional dependency | *.steps.ts |

feat2test generates tests; it does not run the test runner.

npx feat2test generate features test/features --runner node:test
node --test test/features/example.feature.test.ts

Output

For features/payment.feature.md:

test/features/
├── payment.feature.test.ts    # generated; updated automatically
└── payment.feature.steps.ts   # synchronized; matching implementations preserved

The Step Adapter exports createSteps():

export function createSteps() {
  return {
    paymentIsReady(): void {
      // Project implementation
    },
  }
}

Each step is converted literally to camelCase. Placeholders become string parameters; DataTable uses string[][], and DocString uses string. Given, When, and Then group methods as Context, Action, and Outcome.

On every generation, the Feature determines which step methods exist:

  • Same signature: preserve the existing implementation. Repeated steps share one method.
  • Missing from the Feature: remove the method.
  • New signature: create a method that throws PENDING until implemented.

A signature is the method name and its ordered parameter names and types. Changing either the method name or its parameters replaces that method; changing only example values preserves it. Async methods and custom return types are preserved when the signature matches. Renaming one occurrence of a shared step creates a new method; the old method stays until its last occurrence is removed from the Feature.

Methods remain in a flat object. Synchronization orders them by role and first occurrence in the Feature, with one generated heading per nonempty group. Existing duplicate headings are repaired; retained implementations and their comments are copied without rewriting their code.

Keep step methods in the object returned by createSteps(). Imports, factory state, helpers outside that object, and retained methods are preserved. Inline methods and function-valued properties are supported; dynamic structures such as spreads, computed keys, or multiple returned objects produce an error before this Feature's files are written. --check detects signature drift without modifying either output; it does not execute implementations or fail merely because a step is PENDING.

CI

{
  "scripts": {
    "features": "feat2test generate features test/features --runner vitest",
    "test": "npm run features && vitest run",
    "test:ci": "feat2test generate features test/features --runner vitest --check && vitest run"
  }
}

Development

pnpm install
pnpm verify

Complete examples: examples/calculator and examples/order-confirmation.

Gherkin Craft guide: .agents/skills/gherkin-craft.

License

MIT