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

@voxpelli/node-test-pretty-reporter

v1.1.2

Published

Reporter for node:test that supports colorful diffs etc

Downloads

425

Readme

@voxpelli/node-test-pretty-reporter

Reporter for node:test that supports colorful diffs etc

npm version npm downloads neostandard javascript style Module type: ESM Types in JS Follow @voxpelli@mastodon.social

Usage

npm install -D @voxpelli/node-test-pretty-reporter
node --test --test-reporter=@voxpelli/node-test-pretty-reporter

Why another test reporter?

This one is similar to the built-in spec reporter but differs in some ways which I personally prefer.

Rendering diffs from assertions

Outputs colored diffs when a test is failed with an Error that has expected and actual properties (respecting a showDiff property set to false).

Diff is generated by jest-diff (no other part of jest is used in this reporter).

Assertion libraries that outputs compatible errors:

As with other changes, this makes the reporter on par with Mocha.

Output styling

The output styling aligns more with Mocha's spec reporter:

  • ~~Errors are presented at the end instead of in the list of tests~~ (also done in built in since nodejs/node#47164)
  • Less visually intense, eg. no in front of names and only failed tests gets colored
  • Durations are only reported if considered slow (using same default as Mocha: 75ms)
  • No redundant mentioning of a test suite after the suite has completed – opts for a clean tree from top to bottom instead

Outputting the full cause chain of an Error

When used with at least Node 18.17.0 or 20.2.0 this is supported (see issue #2).

Since those same versions the cause chain is also printed in the built in spec reporter, but done through util.inspect() there rather than the custom output here.

Example output

CLI output

Similar modules

I have not tested any of these myself yet so can't say if they work well or not, but adding here for reference.

See also

  • node:test – the full documentation for the node:test module that shipped in Node.js 18
  • nodejs/node-core-test – a userland port of node:test making it available in Node.js 14 and later (this reporter has not been tested with this userland port)
  • @matteo.collina/tspl – test planner for node:test and node:assert