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

nodepup

v1.2.1

Published

run tests with puppeteer and the nodejs test runner

Downloads

732

Readme

nodepup

Run component tests with puppeteer as if they were in node

requirements

  • nodejs > 22
  • a browser that supports es2022

Why does this exist?

  • JSDOM doesn't fully implement the native Web APIs
  • Cypress is too slow
  • Playwright is too hard to integrate into existing projects (and also not as fast)

So this is kind of a "run your unit tests in a browser" enabling library.

Features

  • FAST EXECUTION 🚀 - should theoretically be only slightly slower than jest etc
  • FAST SETUP 🏎️ - no aggregation or unnecessary setup/teardown

Configuration

// nodepup.config.js

/**
 * @type import("nodepup/server").NodepupConfig
 */
export default {
  esbuild: {}, // changeable esbuild options
  coverage: {}, // changeable monocart-coverage-reporter options
  glob: "**/*.test.{ts,tsx}", // an extended glob to find your test files
  bodyContent: "", // html that replaces the document body before every test run
};

Usage

Nodepup installs a simple binary so npx nodepup would be enough. It is possible to configure the run with some environment variables as follows:

process.env.BROWSER (required)

Specify the browser to run the tests in. Must be supported by puppeteer and must be provided in the form <browser>@<tag>. So for example chrome@canary

process.env.BROWSER_ARGS (optional)

You can pass args to the launched browser instance via this environment variable.

Useful e.g. for running in CI environments with --no-sandbox for chrome.

process.env.DEBUG (optional)

By passing any value as DEBUG the given browser will start with the devtools open. You can then set breakpoints and simply reload the spec. The suite will finish when you close the browser.

process.env.IGNORE_WARNINGS (optional)

Passing any truthy value here means that nodepup will exit with status 0 even if tests exist that log errors while still passing.

Filtering tests (optional)

You can provide a filter string that will be used as a regex to only run tests matching that string. E.g. nodepup foobar will run only specs with "foobar" in their description.