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

@l8d/gherkin-lite

v0.1.1

Published

Gherkin-style BDD testing DSL for vitest

Readme

@l8d/gherkin-lite

Gherkin-style BDD testing DSL for vitest. Write feature tests with Given/When/Then step definitions.

Installation

npm install @l8d/gherkin-lite

Peer Dependencies

This package requires vitest (>=1.0.0) and debug (^4.0.0) as peer dependencies. Install them if not already present:

npm install -D vitest debug

Usage

Step 1: Define Step Handlers

Create step definition files using Given, When, and Then:

// steps/when/startGame.ts
import { When } from '@l8d/gherkin-lite/steps'

When('the user starts a new game', async ({ scenario }) => {
  // Your step implementation
})

Steps can accept string or regex patterns:

import { When } from '@l8d/gherkin-lite/steps'

When(/player (\w+) moves to cell \((\d+), (\d+)\)/, async ({ params }) => {
  const [, player, row, col] = params
  // Implementation with captured groups
})

Step 2: Write Feature Tests

Import your step handlers as side effects, then define features with scenarios:

import { Feature } from '@l8d/gherkin-lite'
// Step imports register handlers
import './steps/when/startGame'
import './steps/then/gameShouldShowStatus'

Feature('Tic Tac Toe Game', ({ Scenario }) => {
  Scenario('Starting a new game', [
    'Given the app is rendered',
    'When the user starts a new game',
    'Then the game should show status "Next player: X"',
  ])
})

Custom Fixtures

Pass custom data to all scenarios in a feature:

import { Feature } from '@l8d/gherkin-lite'

Feature<{ routes: React.ReactNode }>(
  'My Feature',
  { routes: myRoutes },
  ({ Scenario }) => {
    Scenario('Test scenario', [
      'Given something',
      'When something happens',
      'Then verify the result',
    ])
  },
)

Step handlers receive custom fixtures:

import { Given } from '@l8d/gherkin-lite/steps'

Given('the app is rendered', async ({ routes }) => {
  // routes is available from custom fixtures
})

API

Feature<TCustom>

Feature<{ routes: React.ReactNode }>(
  name: string,
  options?: { only?: boolean; skip?: boolean } & Partial<TCustom>,
  block: ({ Scenario }) => void,
)

Defines a feature with named scenarios. Registers tests with vitest.

Scenario

Scenario(
  name: string,
  steps: string[],
)

Defines a scenario within a feature. Steps must start with Given, When, Then, or And.

Given, When, Then

Given(text: string | RegExp, handler: HandlerFn<TCustom>) => void
When(text: string | RegExp, handler: HandlerFn<TCustom>) => void
Then(text: string | RegExp, handler: HandlerFn<TCustom>) => void

Register step handlers. Handlers receive fixtures with scenario.id, params (regex captures), and custom fixture data.

Export Paths

  • @l8d/gherkin-liteFeature
  • @l8d/gherkin-lite/stepsGiven, When, Then
  • @l8d/gherkin-lite/types — TypeScript type definitions