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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@-fflow/core

v1.1.0

Published

Core BDD testing package for fflow - Behavior-Driven Development tests in JavaScript

Readme

@fflow/core

Core is the main component of fflow, providing a comprehensive BDD (Behavior-Driven Development) testing framework for JavaScript applications.

Features

  • 🥒 Built on Cucumber.js for industry-standard BDD testing
  • ✅ Integrated with Chai for powerful assertions
  • 🌍 Custom World implementation for scenario context management
  • 🎣 Hooks for setup and teardown operations
  • 📋 Multiple report formats (JSON, HTML, Progress)
  • 🔧 Easy-to-use API for creating custom step definitions

Installation

npm install @fflow/core --save-dev

Quick Start

1. Create a feature file

Create a .feature file in your features directory:

Feature: User Authentication
  As a user
  I want to log in to the system
  So that I can access my account

  Scenario: Successful login
    Given I am on the login page
    When I enter valid credentials
    Then I should be redirected to the dashboard

2. Write step definitions

const { Given, When, Then, expect } = require('@fflow/core');

Given('I am on the login page', function() {
  // Navigate to login page
  this.setContext('currentPage', '/login');
});

When('I enter valid credentials', function() {
  // Simulate entering credentials
  const credentials = {
    username: '[email protected]',
    password: 'password123'
  };
  this.setContext('credentials', credentials);
});

Then('I should be redirected to the dashboard', function() {
  // Verify redirection
  const currentPage = this.getContext('currentPage');
  expect(currentPage).to.equal('/dashboard');
});

3. Run your tests

npm test

API Reference

Step Definitions

const { Given, When, Then } = require('@fflow/core');

Given('a precondition', function() {
  // Setup code
});

When('an action occurs', function() {
  // Action code
});

Then('expect a result', function() {
  // Assertion code
});

World Context

The World provides isolated context for each scenario:

// Store data
this.setContext('key', value);

// Retrieve data
const value = this.getContext('key');

// Clear all context
this.clearContext();

// Access Chai expect
this.expect(actual).to.equal(expected);

Hooks

const { Before, After, BeforeAll, AfterAll } = require('@fflow/core');

BeforeAll(function() {
  // Runs once before all scenarios
});

Before(function() {
  // Runs before each scenario
});

After(function(scenario) {
  // Runs after each scenario
});

AfterAll(function() {
  // Runs once after all scenarios
});

Custom World

Create a custom World class with additional functionality:

const { createWorld, setWorldConstructor } = require('@fflow/core');

const CustomWorld = createWorld({
  // Add custom properties or methods
  apiClient: null,
  
  async makeRequest(endpoint) {
    // Custom method
    return await this.apiClient.get(endpoint);
  }
});

setWorldConstructor(CustomWorld);

Configuration

Create a cucumber.js file in your project root:

module.exports = {
  default: {
    require: [
      'features/step_definitions/**/*.js',
      'features/support/**/*.js'
    ],
    format: [
      'progress',
      'json:reports/cucumber_report.json',
      'html:reports/cucumber_report.html'
    ],
    publishQuiet: true
  }
};

Available Scripts

  • npm test - Run all tests
  • npm run test:watch - Run tests in watch mode
  • npm run test:dry-run - Validate feature files without executing
  • npm run test:parallel - Run tests in parallel
  • npm run test:tags @tagname - Run specific tagged scenarios
  • npm run report - Generate test reports

Project Structure

your-project/
├── features/
│   ├── step_definitions/
│   │   └── your_steps.js
│   ├── support/
│   │   ├── world.js
│   │   └── hooks.js
│   └── your.feature
├── cucumber.js
└── package.json

Best Practices

  1. Keep scenarios focused: Each scenario should test one specific behavior
  2. Use Background wisely: Only include steps that are truly common to all scenarios
  3. Write declarative scenarios: Focus on what, not how
  4. Reuse step definitions: Create generic, reusable steps when possible
  5. Use tags for organization: Tag features and scenarios for selective execution

Example Project

Check out the included example in the features directory to see a working calculator implementation with:

  • Feature file with multiple scenarios
  • Step definitions
  • World context usage
  • Scenario outlines with examples

Contributing

Please submit issues and pull requests to the fflow/core repository.

License

ISC