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

test-in-build

v0.2.0

Published

Validate your library by installing it into test builds.

Downloads

25

Readme

Test Build

Installs your package into a test project, and verifies the result.

Rationale

If you're developing a node-based tool that participates in the build process, you need to be able to validate both how it works and how it fails. This can be tricky to do in a single project, so instead we create a selection of (hopefully simpler) test projects and install our tool there.

How it works

We don't build our test projects in-situ, because we don't want the act of testing them to modify them. So we copy the test into a temporary directory and install the package under test into it there.

The calling package needs to specify what the actual test step should look like. Normally this will entail calling npm, or possibly another tool like tsc if you don't want to set up all your test projects with a complete build environment.

test-in-build will load a JS file called expect.cjs. This gives test authors the ability to inspect the build output for correctness

Use

Recommended usage follows the pattern in test/packages.test.ts. You need to pass in the project base directory, relative to the working directory when the test is executed. This will normally be '.', unless you have a workspace project. The second parameter is the parent directory for your successful and failing directories -- these should themselves contain a directory per test case.

The third parameter gives the caller the opportunity to inspect the test and request a command to be executed. You may make this function as complex as you like, but I'd recommend putting per-test logic in the test itself.

Releasing

We use npm versions and GitHub Actions to release.

On your local machine, with main checked out, run npm version patch or whatever bump is appropriate. This will create a new commit and a tag starting with v containing the version. Push the tag to GitHub. We protect tags starting with v, so this step may only be undertaken by repository administrators.

In the GitHub UI, wait until the tag has finished its CI build. Now we may push the main branch without hitting branch protections. Do so.

Again in the GitHub UI, find the tag. Use the three dot menu on the tag to create a release. Use the auto-fill button to populate the release notes, and publish the release.

GitHub Actions will now build the release and publish it to NPM.