@currents/jest

Currents reporter for Jest

Currents reporter for Jest generates test results that for uploading to Currents.

The reporter stores the generated results in a temporary directory. Upload the generated results using a separate package @currents/cmd.

Setup

npm install @currents/jest @currents/cmd --save-dev

Add the reporter to Jest configuration:

import type { Config } from "jest";

const config: Config = {
  reporters: ["default", "@currents/jest"],
};

export default config;

or set the --reporters option when running the jest

npx jest --reporters=@currents/jest

The reporter saves the test results in a temporary folder named .currents-report-[timestamp]-[uuidv4()].

We recommend adding.currents-report* to .gitignore

Usage

  • Configure the reporter

  • Run the tests npx jest

  • Use currents from @currents/cmdpackage to upload the results

Example:

$ npx jest --reporters=@currents/jest --reporters=default
[currents]: Run started
[currents]: Report directory is set to - /Users/agoldis/immer/.currents-report-2024-07-16T20-33-12-555Z-478913e1-1916-499b-8d8d-c08043d50f3d
# ....
[currents]: [__tests__/base.js] - spec results written to file: /Users/agoldis/immer/.currents-report-2024-07-16T20-33-12-555Z-478913e1-1916-499b-8d8d-c08043d50f3d/instances/Aql-q2CM.json
[currents]: Run completed

# 📖 see @currents/cmd documentation
$ npx currents upload --key=XXX --project-id=C3lBM6
Currents config: {
  projectId: 'C3lBM6',
  recordKey: '*****',
  removeTitleTags: false,
  disableTitleTags: false,
  debug: false
}
Report directory: '.currents-report-2024-07-16T20-33-12-555Z-478913e1-1916-499b-8d8d-c08043d50f3d'
[root] Run created: 'https://app.currents.dev/run/8466c149d9bbf745'
Script execution finished
  Done in 17.96s.

Configuration

PropertyTypeDescriptionEnvironment variableDefault

reportDir

string

Test results directory

CURRENTS_REPORT_DIR

.currents-report-[timestamp]-[uuidv4]

Troubleshooting

Set DEBUG=currents* before running jest to obtain detailed information about the reporter execution process.

Last updated

Change request #465: SCIM documentation