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

factable

v1.0.0-beta.3

Published

A test case generation tool for nodejs babel transpiled projects

Readme

Factable

A test case generation and managment tool for nodejs babel transpiled projects.

Contents

What is Factable?

Factable intercepts your runtime function calls, lets you visualize and define your relevant test cases and then writes tests for them.

Even if you dont't care about test generation, Factable is a great tool to be aware of what's really happening with your functions.

Why?

Have you ever found yourself running your app and logging your function call inputs and outputs just to use them for your test mocks and assertions?

Have you ever wanted a way to register your runtime function calls to help you build your tests?

We are lazy. Every time we find ourselves doing stuff that could be automated or at least assisted, we go for it. Thats why Factable exists.

How does it work?

First, your function body is wrapped (at transpiling time) through a babel plugin that registers all relevant runtime information.

Then, that information is sent to a local server which serves it to the browser, where the client UI resides.

Lastly, UI client connects to the server through http and websockets to manage user interaction.

Factable Server can register function calls and write and delete test files.

Factable saves its state in "factable.json" file in the root of your project. Every test metadata is saved there. You should include it in your git tracked files.


Quick start

  1. Install factable as dev dependency:
npm install -D factable
  1. Add factable babel plugin to your current babel config:

    .babelrc:

    Notice "module:" prefix is required

    or to babel.config.js:

  2. Add Factable to your scripts:

    Remember Factable is just a dev-tool and should only be used in your development process.

    Please don't use it in your production builds!

    • Set env variable FACTABLE_TRANSPILE={PORT} in every development (babel related) build script:

    package.json

    or:

    FACTABLE_TRANSPILE=8888 tells factable to transpile and set Factable Server port to 8888.

    • Add a script to start Factable Server:

    package.json

    factable-server-run 8888 is the cli command that launches Factable Server on port 8888 Make sure to put the same port value in both build and Factable Server scripts.

  3. Add factable comment at the top of any file where you want Factable to intercept function calls:

  1. Start Factable Server:

    npm run factable

    This will launch a browser window with the UI.

  2. Run your app with Factable flag:

    npm run dev:factable
  3. Play with Factable Server UI and find your function and its calls. Please, refer to Factable UI usage for more information.


Try Factable with Factable Test Project

You can also try Factable just cloning Factable Test Project and following its instructions.


Facts about Factable

  • Factable helps you understand your functions better.
  • Factable pretends to help you build tests as soon as possible.
  • Factable likes and promotes TDD and BDD.
  • Factable loves Funcional Programming (pure functions, inmutability) and aims to be a tool that promotes its best practices and increases awareness about its benefits.
  • Factable tests are not perfect and will not always pass: It's up to you to make them work and pass! There are many cases (examples later) where factable can't build your function call, but it is still very usefull as it takes care of all the boilerplate. For now, you can freely manually edit and fix test files, just remember not to 'Edit' or 'Discard' it from Factable UI
  • Factable is intended to be used with Git: we write, update, and also eventually delete test files, so we rely on git for recovering any previous file state.
  • Factable only captures function calls server-side. Client-side is still a work in progress.
  • Remember Factable is just a dev-tool and should only be used in your development process. Please don't use it in your production builds!