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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@exodus/test

v1.0.0-rc.63

Published

A test suite runner

Downloads

4,541

Readme

@exodus/test

A runner for node:test, jest, and tape test suites on top of node:test (and any runtime)

Features

  • Native ESM, including in Jest tests
  • Esbuild on the fly for babelified ESM interop (enable via --esbuild)
  • TypeScript support in both transform (through tsx, enable via --esbuild) and typestrip (via --typescript) modes
  • Runs on node:test, and (experimental) on bun, deno, d8, JSC and Hermes
  • Testsuite-agnostic -- can run any file as long as it sets exit code based on test results
  • Built-in Jest compatibility (with --jest), including jest.* global
    • Up to ~10x faster depending on the original setup
    • Actual expect module, also jest-extended and jest-when just work on top
    • Snapshots, including snapshot matchers
    • Function and timer mocks
    • test.concurrent
    • Module mocks (on top of Node.js runtime only), including for ESM modules
    • Loads Jest configuration
    • It works on Hermes too!
  • Built-in network record/replay for offline tests, mocking fetch and WebSocket sessions
  • --drop-network support for guaranteed offline testing
  • Native code coverage via v8 (Node.js or c8), with istanbul reporters
  • GitHub reporter (auto-enabled by default)
  • JSDOM env support
  • Hanging tests error by default (unlike jest)
  • Babel support, picks up your Babel config (enable via --babel)
  • Unlike bun:test, it runs test files in isolated contexts
    Bun leaks globals / side effects between test files (ref), and has incompatible test() lifecycle / order
  • Also features a tape API for drop-in replacement

Reporter samples

CLI (but uses colors when output supports them, e.g. in terminal):

# tests/jest/expect.mock.test.js
✔ PASS drinkAll > drinks something lemon-flavoured (1.300417ms)
✔ PASS drinkAll > does not drink something octopus-flavoured (0.191791ms)
✔ PASS drinkAll (1.842959ms)
✔ PASS drinkEach > drinkEach drinks each drink (0.360625ms)
✔ PASS drinkEach (0.463416ms)
✔ PASS toHaveBeenCalledWith > registration applies correctly to orange La Croix (0.53325ms)
✔ PASS toHaveBeenCalledWith (0.564166ms)
✔ PASS toHaveBeenLastCalledWith > applying to all flavors does mango last (0.380375ms)
✔ PASS toHaveBeenLastCalledWith (0.473417ms)
# tests/jest/fn.invocationCallOrder.test.js
✔ PASS mock.invocationCallOrder (4.221042ms)

GitHub Actions collapses test results per-file, like this:

See live output in CI

Library

List of exports

  • @exodus/test/node -- node:test API, working under non-Node.js platforms

  • @exodus/test/jest -- jest implementation

  • @exodus/test/tape -- tape mock (can also be helpful when moving from tap)

Binary

Just use "test": "exodus-test"

Options

  • --jest -- register jest test helpers as global variables, also load jest.config.* configuration options

  • --esbuild -- use esbuild loader, also enables Typescript support

  • --babel -- use babel loader (slower than --esbuild, makes sense if you have a special config)

  • --coverage -- enable coverage, prints coverage output (varies by coverage engine)

  • --coverage-engine c8 -- use c8 coverage engine (default), also generates ./coverage/ dirs

  • --coverage-engine node -- use Node.js builtint coverage engine

  • --watch -- operate in watch mode and re-run tests on file changes

  • --only -- only run the tests marked with test.only

  • --passWithNoTests -- do not error when no test files were found

  • --write-snapshots -- write snapshots instead of verifying them (has --test-update-snapshots alias)

  • --test-force-exit -- force exit after tests are done (useful in integration tests where it could be unfeasible to resolve all open handles)

License

MIT