description |
---|
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.
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.


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:
{% code title="jest.config.js" %}
import type { Config } from "jest";
const config: Config = {
reporters: ["default", "@currents/jest"], // Add this line to your config
};
export default config;
{% endcode %}
Option 2: Pass our reporter as an argument when executing Jest.
{% code title="package.json" %}
{
...
"scripts": {
...
"test": "jest --reporters=@currents/jest",
},
...
}
{% endcode %}
Update your .gitignore
Add a line in your .gitignore to avoid pushing temporary generated reports to your repository.
.currents
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.md
npx jest --reporters=@currents/jest
Run the following command to upload the last results to Currents dashboard (see currents-upload.md)
npx currents upload --key=XXX --project-id=YYY
Set the Record Key, and Project ID obtained from Currents dashboard in the previous step.
{% hint style="info" %} You can defined the Record Key and Project ID in the Reporter configuration. {% endhint %}
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
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.
{% hint style="info" %} It is important to ensure that
npx jest --reporters=@currents/jest
and currents upload
share the same environment variables
{% endhint %}