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

tap-arc

v1.3.2

Published

spec-like TAP reporter

Downloads

7,723

Readme

Objectives

  • minimal, informative spec-like output for all assertion types
  • helpful diffing for failures
  • shallow graph of maintained dependencies

tap-arc output screen shot

Installation and Usage

Compatible with Node.js v16+ -- v14 also works but is not recommended.

Save tap-arc as a development dependency:

npm i -D tap-arc

Simply pipe tap output to tap-arc.
Example npm test script:

// package.json
"scripts": {
  "test": "tape test/**/*.js | tap-arc"
}

[!IMPORTANT]
💁 tap-arc will format output from any tap reporter. tape is our favorite and was used for testing.

tap-arc --help

Usage:
  tap-arc <options>

Parses TAP data from stdin, and outputs a "spec-like" formatted result.

Options:

  -v | --verbose
    Output full stack trace, TAP version, and plan

  -p | --pessimistic | --bail
    Immediately exit upon encountering a failure
    example: tap-arc -p

  --no-diff
    Do not show diff for failed assertions
    example: tap-arc --no-diff

  --no-color
    Output without ANSI escape sequences for colors
    example: tap-arc --no-color

  --fail-bad-count
    Fail when the number of assertions parsed does not match the plan
    example: tap-arc --fail-bad-count

Development

When building tap-arc, it's helpful to try various TAP outputs. See package.json "scripts" for useful "tap-arc.*" commands to test passing and failing TAP.

npm run tap-arc.simple # used to create the screen shot above

Dev Tips

  1. To see previous exit code, run:
echo $?

Testing

Primarily, tap-arc is tested to output the correct exit code based on your test suite's TAP output.

Testing could be improved by unit testing the printer and diff maker.

FAQ

What happened?
✅ The TAP parser found zero failing tests
✅ The final tally from the raw TAP shows n of n passed
🤨 But the TAP plan called for more tests than were found, counted, and parsed.

💁‍♀️ Currently, when this case is detected, tap-arc will exit with a successful status code.
This can be overridden with the --fail-bad-count flag.

Why, though?
This has been observed specifically on Windows, where the TAP output is buffered to another stream and not piped to tap-arc.
Libraries like mock-fs tinker with stdout and subsequent TAP output is lost. Try closing those helpers before making an assertion that generates TAP.

Yes. At least one passing test is required to pass the suite.
This helps ensures there wasn't a silent, catastrophic failure in the test suite.

tap-arc is responsible for the test suite's exit code. If your entire CI stack is piped to a reporter, it's an important job. So tap-arc is a bit skeptical by default to help ensure your suite is passing.

If you'd like to see different behavior from tap-arc, please open an issue or PR. We'd love to hear your use case.

Credit & Inspiration

  • tap-spec ol' reliable, but a bit stale and vulnerable
  • tap-difflet inspired output and diffing, also vulnerable