Socket
Socket
Sign inDemoInstall

@recordreplay/jest

Package Overview
Dependencies
8
Maintainers
7
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @recordreplay/jest

CLI wrapper for recording jest tests


Version published
Weekly downloads
761
decreased by-43%
Maintainers
7
Install size
1.66 MB
Created
Weekly downloads
 

Readme

Source

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.

FAQs

Last updated on 01 Mar 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc