Jest
Submit and collect your Jest results in Testiny to track automated test runs. By integrating Jest with Testiny, you can gain valuable insights into your testing process. Track automation results over time, identify frequently failing tests, and detect patterns in test failures to fix CI failures and find flaky tests.
Generate JUnit Reports
Run your Jest test with the built-in jest-junit reporter (or any another reporter, that outputs JUnit-style reports):
npx jest --reporters="jest-junit"
Or specify the reporter and the output directory in your Jest config:
/** @type {import('jest').Config} */
const config = {
reporters: [
'default',
['jest-junit', {outputDirectory: 'reports', outputName: 'report.xml'}],
],
};
module.exports = config;
The reporter will create a report in the specified output folder and specified file name.
Import Results to Testiny
Make sure you've generated an API key and use the Testiny CLI to import the results to Testiny:
- Node.js/npm
- Linux
- Windows
- macOS
export TESTINY_API_KEY=****
npx @testiny/cli automation --project ID_OR_KEY --source "frontend" --junit reports/report.xml export TESTINY_API_KEY=****
./testiny-importer-linux automation --project ID_OR_KEY --source "frontend" --junit reports/report.xml set TESTINY_API_KEY=****
testiny-importer-win.exe automation --project ID_OR_KEY --source "frontend" --junit reports/report.xml export TESTINY_API_KEY=****
./testiny-importer-macos automation --project ID_OR_KEY --source "frontend" --junit reports/report.xml In the above example, the environment variable TESTINY_API_KEY is set to authenticate the request.
The --project flag specifies the target Testiny project using its ID or key and the --source flag categorizes the test results (e.g., frontend, backend, integration tests, ...).
The --junit flag specifies the format of the specified test result file(s).
Once executed, the Testiny CLI will automatically create a new automated test run in Testiny and import all results from the specified report(s).
More resources
Here are some further resources to help you get started with integrating Jest with Testiny, including CI/CD integration examples, a full automation guide, and the Testiny CLI.