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

mocha-reporter-remote

v1.7.1

Published

Deliver Mocha reporter events over TCP or socket connection

Downloads

6

Readme

mocha-reporter-remote

Deliver Mocha progress events over Unix sockets/TCP connections to someplace else

This reporter allows Mocha to send its progress updates, which would normally appear on console, somewhere else - over Unix sockets or plain TCP connections. This is useful if you need Mocha to "contact" some independent process and feed it with progress, like IDE-Mocha for Atom, but the use cases are not limited to that.

Usage

Just install the reporter into your project:

npm i -D mocha-reporter-remote

And then run Mocha with the chosen reporter and specify where the reporter should send the events:

# For Unix socket connections, specify where the socket exists:
npx mocha --reporter mocha-reporter-remote --reporter-options address=/var/folders/np/yp1y_nk504b0k61prl2pk4b40000gn/T/mocha-reporter-remote.sock

# For TCP connections, just pick a port to connect to:
npx mocha --reporter mocha-reporter-remote --reporter-options address=12345

The socket or TCP server must exist before the reporter starts. The receiving end should likely be permanently listening for data regardless of whether or not Mocha is actually being run. ⚠️

Reporter options

The following options are accepted by this reporter:

  • root: Specifies the root directory where Mocha is being run. This is useful for auto-detecting the socket or port of the remote listener. Default: current working directory.
  • mode: Specifies the networking mode to be used. Allowed values are unix for Unix sockets, ip / IP for TCP. Default: unix everywhere except Windows, where the default is IP.
  • address: Either TCP port number of the absolute path to the unix socket to which to send events. Only used if root is not provided. ⚠️
  • nostats: When set to 1 or any "truthy" value, Mocha will not print the final test stats to the console when it is done running. Default: 0.

Reporter options can be provided on the command line or via .mocharc.js or similar mechanism.

Command line:

# Using address
mocha --reporter mocha-reporter-remote --reporter-options address=/path/to/socket.sock,nostats=1
# using root
mocha --reporter mocha-reporter-remote --reporter-options root=${PWD},nostats=1

mocharc.js:

module.exports = {
  reporter: 'mocha-reporter-remote',
  // This has to be singular, `reporterOptions` does not seem to
  // parse the options correctly
  reporterOption: [
    'address=/path/to/socket.sock',
    'nostats=1'
  ]
  // ... other Mocha options
}

Receiving events

@TODO 😢

For now, have a look at what data is being sent to the receiving end here and how the data is parsed from the socket and consumed here.

License

See the LICENSE file for information.