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

@recordreplay/jest

v0.4.0

Published

CLI wrapper for recording jest tests

Downloads

773

Readme

Replay Jest

replay-jest is a wrapper around Jest that creates recordings of failed tests for debugging using the Replay devtools.

Installing

Install replay-jest either locally within the project, or globally with -g. replay-jest uses the replay-node package and is currently only available on macOS and linux.

npm i @recordreplay/jest

If replay-jest and jest are local to a package, add a script to the package.json:

  "scripts": {
    "replay-jest": "replay-jest",
  },

Usage

Recording and uploading tests requires an API key, see the settings in the replay devtools to obtain one. Set the RECORD_REPLAY_API_KEY environment variable to this key while running replay-jest.

If replay-jest and jest are installed globally, record tests by running replay-jest.

If replay-jest and jest are installed locally, run the script added to package.json: npm run replay-jest or yarn replay-jest.

replay-jest runs all tests normally. Afterwards, it detects failed tests and creates recordings for each of them, uploading them to the replay web service and ensuring they have been processed so they will load quickly. Lines like the ones below will be logged to show progress and any errors. The recording URLs can be loaded in any web browser for debugging.

replay-jest $TestPath: Creating recording...
replay-jest $TestPath: Uploading and processing recording...
replay-jest $TestPath recording: https://app.replay.io/recording/$RecordingId

By default, recordings will only be created for failing tests, and at most 10 recordings will be created in one test run.

To override this default behavior, a configuration JSON object can be specified with additional options. This can be specified either via the value of the RECORD_REPLAY_JEST_CONFIGURATION environment variable, or in a file referenced by the RECORD_REPLAY_JEST_CONFIGURATION_FILE environment variable.

Configuration objects can have the following properties:

  • maxRecordings: A number overriding the maximum number of recordings which can be created in one test run.

  • recordAll: Set to record all tests, up to the maximum number of recordings allowed.

  • randomize: Set to randomize which tests will be selected to record if there are more than the maximum number allowed. This is useful to improve coverage in CI environments when there are many tests which could be recorded.