Configure Jest to create test results
Add jest-junit as dependency
Install the package jest-junit as a development dependency:
npm install --save-dev jest-junityarn add --dev jest-junitpnpm add --save-dev jest-junitCreate JUnit reports with Jest
Add the jest-junit reporter to the jest config file to create JUnit report
files:
jest.config.json
{
"reporters": [
"default",
[
"jest-junit",
{
"outputDirectory": "<rootDir>/junit-reports",
"uniqueOutputName": "true",
"suiteName": "e2e tests",
"outputName": "e2e",
"addFileAttribute": "true",
"reportTestSuiteErrors": "true",
"includeConsoleOutput": "true",
"classNameTemplate": "{classname}",
"titleTemplate": "{title}",
"ancestorSeparator": " › "
}
]
]
}