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

node-test-reporter

v1.0.3

Published

Test reporter for the node test runner

Downloads

154

Readme

Test reporter for the node test runner

npm Version

This is a test reporter tailored to the node test runner, that was introduced in node v18. The runner is tested with node v20 and v22, but should work in other versions too. See note below on coverage in v20.

The reporter will list all tests as they run, with a running count of the total number of tests started and how many passed or failed. When done, we print all diagnostic messages, errors, and a summary. If code coverage is enabled, we print a summary of the coverage percentages too.

Installing and using

npm install node-test-reporter -D

To run your tests:

node --test --test-reporter node-test-reporter 'src/**/*.test.js'

This is best run as a script in your package.json:

"scripts": {
  ...
  "test": "node --test --test-reporter node-test-reporter 'src/**/*.test.js'"
  ...
}

[!NOTE] We use 'src/**/*.test.js' here to include all files ending with .test.js below the src folder. The ** glob have only worked like this since node v21, and only when surrounded by quotes. This was a breaking change in node. For older versions, you may use src (without quotes) instead. See this disussion for more.

TypeScript

To run TypeScript tests, install e.g. the tsx package and run your tests like this:

node --import tsx --test --enable-source-maps --test-reporter node-test-reporter 'src/**/*.test.ts'

By enabling source maps with --enable-source-maps, you'll get the correct line and column numbers for your .ts files.

Coverage

Code coverage is still experimental in node v22, but may be included like this:

node --test --experimental-test-coverage --test-reporter node-test-reporter 'src/**/*.test.js'

[!NOTE] The experimental test covarge is available from node v18, but has a bug in v20 where it will throw an error in some instances. We recommend using v22 for coverage. See this discusson for more.

Running the tests

This repo ironically doesn't have any tests yet. :S

Contributing

Please read CONTRIBUTING for details on our code of conduct, and the process for submitting pull requests.

License

This project is licensed under the ISC License - see the LICENSE file for details.