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-sauce-notifying-reporter

v0.0.3

Published

Reporter plugin for the mocha test runner (on node) that jobUpdate's Sauce Labs with suite pass/fail at the end of a run.

Downloads

2

Readme

mocha-sauce-notifying-reporter

Reporter plugin for the mocha test runner (on node) that jobUpdate's Sauce Labs with suite pass/fail at the end of a run.

NPM version Dependency Status Development Dependency Status

This is a plugin for the JavaScript test runner mocha, developed for running tests under node.js that are using browsers at Sauce Labs. It watches for mocha's test end event, then looks at the count of failed test cases that were run. It then uses jobUpdate in the Sauce Labs API to tell Sauce Labs whether the test run passed or failed. If the number of failures counted by mocha's base reporter is zero, then it sends passed: true to Sauce Labs, otherwise passed: false.

##Usage

###Installation

Include mocha-sauce-notifying-reporter in your package.json as you normally would, either by editing or

npm install mocha-sauce-notifying-reporter --save-dev

###Invoking mocha

You can then use the reporter by specifying it when you invoke mocha. For example, on the command line:

mocha --reporter mocha-sauce-notifying-reporter

Unlike most reporters, this one produces no text output of its own — it only sends notifications to Sauce Labs. Assuming that you'd also like some other kind(s) of output from your test runs, you can invoke it along with other reporter(s) using the NPM mocha-multi. After installing mocha-multi, that might look something like this on the command line:

export multi='spec=- mocha-sauce-notifying-reporter=-'
mocha --reporter mocha-multi

###Integrating With Your Tests

The reporter automatically gets the count of failed test cases from mocha — that's the great thing about it being a reporter. However, it also needs information in order to communicate with your account at Sauce Labs and to identify the particular Sauce job that corresponds to your test run, so that the test results go to the right place.

For Sauce Labs access credentials, mocha-sauce-notifying-reporter reads the environment variables SAUCE_USERNAME and SAUCE_ACCESS_KEY. These are the same environment variables that are read by the Sauce Connect secure tunneling tool, and you've likely already established a means for setting them in your testing environment(s).

To identify the Sauce Labs jobId for your test run, the reporter expects your infrastructure to have placed the tests' WebDriver session ID into the environment variable SAUCE_SESSION_ID before the test run ends. Sauce Labs is organized so that the same identifier is used as the WebDriver session ID (which you should be able to obtain through whichever WebDriver protocol library you are using to execute tests), and as Sauce's REST API jobId, and as the unique per-test identifier in URLs for Sauce Labs' web UI.

For example, this snippet of JavaScript code uses the selenium-webdriver.js library, and could be inserted in your tests immediately after you make your connection to Sauce Labs and have a driver object:

driver.getSession().then(function (session) {
  process.env.SAUCE_SESSION_ID = session.getId();
});