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

js-reporters

v2.1.0

Published

Common reporter interface for JavaScript testing frameworks.

Downloads

236,805

Readme

js-reporters

Chat on Gitter Build Status Coverage Status npm npm

The Common Reporter Interface (CRI) for JavaScript Testing Frameworks.

| Avoid this: | Do this: | |----------------------------|----------------------------------| | | |

Specification

See Common Reporter Interface for the latest version of the specification.

See also:

  • example, illustrates how reporting works in practice.
  • frameworks, studies various popular testing frameworks.
  • Integrations, a list of real-world implementations.

Help with AsciiDoc (used for the standard document):

Background

In 2014, the QUnit team started discussing the possibility of interoperability between JavaScript testing frameworks such as QUnit, Mocha, Jasmine, Intern, Buster, etc. The "Common Reporter Interface" would be an allow integrations for output formats and communication bridges to be shared between frameworks. This would also benefit high-level consumers of these frameworks such as Karma, BrowserStack, SauceLabs, Testling, by having a standard machine-readable interface.

Our mission is to deliver:

  • a common JavaScript API, e.g. based on EventEmitter featuring .on() and .off().
  • a minimum viable set of events with standardized event names and event data.
  • a minimum viable set of concepts behind those events to allow consumers to set expectations (e.g. define what "pass", "fail", "skip", "todo", and "pending" mean).
  • work with participating testing frameworks to support the Common Reporter Interface.

Would you be interested in discussing this with us further? Please join in!

js-reporters Package

Usage

Listen to the events and receive the emitted data:

// Use automatic discovery of the framework adapter.
const runner = JsReporters.autoRegister();

// Listen to standard events, from any testing framework.
runner.on('testEnd', (test) => {
  console.log('Test %s has errors:', test.fullName.join(' '), test.errors);
});

runner.on('runEnd', (run) => {
  const counts = run.testCounts;

  console.log('Testsuite status: %s', run.status);
  console.log('Total %d tests: %d passed, %d failed, %d skipped',
    counts.total,
    counts.passed,
    counts.failed,
    counts.skipped
  );
  console.log('Total duration: %d', run.runtime);
});

// Or use one of the built-in reporters.
JsReporters.TapReporter.init(runner);

Runtime support

  • Internet Explorer 9+
  • Edge 15+ (Legacy)
  • Edge 80+ (Chromium-based)
  • Safari 9+
  • Firefox 45+
  • Chrome 58+
  • Node.js 10+

Adapter support

| Testing framework | Supported | Last checked | Unresolved |--|--|--|-- | QUnit | 1.20+ | ✅ [email protected] (Apr 2021) | – | Jasmine | 2.1+ | ✅ [email protected] (Apr 2021) | – | Mocha | 1.18+ | ✅ [email protected] (Apr 2021) | –

See also past issues.

API

autoRegister()

Automatically detects which testing framework you use and attaches any adapters as needed, and returns a compatible runner object. If no framework is found, it will throw an Error.

JsReporters.autoRegister();

Integrations

Runners:

Reporters:

  • TAP, implements the Test Anything Protocol for command-line output.
  • browserstack-runner, runs JavaScript unit tests remotely in multiple browsers, summarize the results by browser, and fail or pass the continuous integration build accordingly.
  • Add your own, and let us know!

Cross-project coordination

Testing frameworks:

Reporters and proxy layers:

Credits

Testing Powered By SauceLabs