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

@deepracticex/vitest-cucumber-plugin

v1.4.3

Published

Vitest plugin for transforming Cucumber feature files to test code

Readme

@deepracticex/vitest-cucumber-plugin

Internal implementation package - Users should install @deepracticex/vitest-cucumber instead.

For Users

This package contains the build-time transformation logic for Cucumber feature files. You don't need to install it directly.

Install the main package instead:

pnpm add -D @deepracticex/vitest-cucumber

See the main documentation for usage guide.


For Contributors & Advanced Users

This package is the compile-time plugin that transforms .feature files into Vitest test code.

Architecture Role

User Code (.feature files)
    ↓
vitest-cucumber-plugin (this package)
    • Parses Gherkin with @cucumber/gherkin
    • Generates Vitest test code
    • Handles step discovery
    ↓
Generated Test Code
    ↓
vitest-cucumber (runtime)
    • Executes steps
    • Manages hooks
    • Provides DataTable API

Key Features

  • Build-time transformation - Zero runtime overhead
  • Official Gherkin parser - Uses @cucumber/gherkin
  • Auto-discovery - Finds step definitions automatically
  • Configurable runtime - Support for wrapper packages via runtimeModule option

Plugin Configuration

import { vitestCucumber } from '@deepracticex/vitest-cucumber-plugin';

vitestCucumber({
  // Feature file patterns
  features: ['features/**/*.feature'],

  // Step definitions directory
  steps: 'tests/steps',

  // Support files (hooks, world, custom types) - OPTIONAL
  // Auto-discovered if not specified
  support: 'tests/support', // or ['tests/support', 'src/fixtures']

  // Runtime module for imports
  runtimeModule: '@deepracticex/vitest-cucumber', // default

  // Verbose logging
  verbose: false,
});

Support Directory Auto-Discovery

If support is not specified, the plugin automatically searches for support files in:

  1. Smart detection - Same parent as steps directory:

    • steps='tests/bdd/steps' → checks tests/bdd/support
    • steps='tests/e2e/steps' → checks tests/e2e/support
    • steps='src/test/steps' → checks src/test/support
  2. Common fallback locations:

    • tests/e2e/support/**/*.ts
    • tests/support/**/*.ts
    • tests/bdd/support/**/*.ts
    • ${steps}/support/**/*.ts

Support files are always loaded BEFORE step definitions to ensure hooks and world setup are available.

Examples

// Example 1: Auto-discovery (recommended)
vitestCucumber({
  steps: 'tests/bdd/steps',
  // Automatically finds: tests/bdd/support
});

// Example 2: Explicit single directory
vitestCucumber({
  steps: 'tests/steps',
  support: 'tests/support',
});

// Example 3: Multiple support directories
vitestCucumber({
  steps: 'tests/steps',
  support: ['tests/support', 'src/test/fixtures'],
});

Implementation Details

Transformation Pipeline:

  1. Parse .feature file with @cucumber/gherkin
  2. Extract scenarios, backgrounds, examples
  3. Generate Vitest test code with proper imports
  4. Auto-discover and import step definitions

Code Generation:

  • Each Feature → describe() block
  • Each Scenario → it() test
  • Background steps → Run before each scenario
  • Scenario Outline → Multiple it() tests with data

Custom Runtime Module

For wrapper packages, use runtimeModule to redirect imports:

vitestCucumber({
  runtimeModule: '@your-org/testing-utils',
});

Generated code will import from your package instead:

import { StepExecutor } from '@your-org/testing-utils/runtime';

Your package re-exports from @deepracticex/vitest-cucumber:

export * from '@deepracticex/vitest-cucumber/runtime';

Contributing

See the main repository for contribution guidelines.

License

MIT