Your First Jest Run

Running Jest tests with Currents dashboard

Setting up Currents for running and recording Jest tests in parallel can be done seamlessly within a few minutes.

Prerequisites

Create an Organization and a Project

After signing up for the dashboard service, you will be prompted to create a new organization and a project. You can change their names later.

Creating an Organization and a Project in Currents dashboard

After creating a new organization and a project, you'll see on-screen instructions with your newly created Project ID and Record Key.

Select Jest from the framework selection list.

Install @currents/jest and @currents/cmd packages
npm install @currents/jest @currents/cmd --save-dev

Note: @currents/jest requires

  • Jest v29.5.0+

  • Node.js v18.20.4+

Use the Currents reporter

You have two options on how to use our reporter.

Option 1: Update Jest configuration file:

jest.config.js
import type { Config } from "jest";

const config: Config = {
  reporters: ["default", "@currents/jest"], // Add this line to your config
};

export default config;

Option 2: Pass our reporter as an argument when executing Jest.

package.json
{
  ...
  "scripts": {
    ...
    "test": "jest --reporters=@currents/jest",
  },
  ...
}
Update your .gitignore

Add a line in your .gitignore to avoid pushing temporary generated reports to your repository.

.currents

Your First Jest Run

Upon running Jest tests, Currents reporter for jest generates a temporary folder containing the test results. To upload the results to Currents, you must run currents upload

Step 1: Run the tests

npx jest --reporters=@currents/jest

Step 2: Upload the results

Run the following command to upload the last results to Currents dashboard (see currents upload)

npx currents upload --key=XXX --project-id=YYY

Set the Record Key, and Project ID obtained from Currents dashboard in the previous step.

You can defined the Record Key and Project ID in the Reporter configuration.

Explore Your First Run

The execution results will show on the Currents dashboard. The latest report should be uploaded to Currents, and a link to the run will be displayed.

A link to the recorded results

Good To Know

To provide reliable information about your tests, Currents run a "discovery" process - i.e. exploring the full test suite details. The discovery runs as part of currents upload command. Behind the scenes, the command runs jest in discovery mode.

It is important to ensure that

npx jest --reporters=@currents/jest and currents upload share the same environment variables

Last updated

Was this helpful?