Jest
First install jest-reporters-html:
npm install --save-dev jest-reporters-htmlThen you can run jest with npx jest --reporters jest-reporters-html or add it to your jest.config.js:
module.exports = { reporters: ['default', 'jest-reporters-html'],}- run: npx jest- uses: actions/upload-artifact@v4 if: always() with: name: jest path: jest_html_reporters.html
Coverage
Section titled “Coverage”Jest has a built-in coverage reporter which outputs HTML — if you’re paying for codecov… maybe you don’t need to anymore. Just run jest --coverage via the CLI, or see jest docs. Then upload the artifact:
- run: npx jest --coverage- uses: actions/upload-artifact@v4 if: always() with: name: jest path: coverageOr you can combine the HTML output with the coverage report:
module.exports = { reporters: ['default', ['jest-html-reporters', {publicPath: './report'}]],}- run: npx jest --coverage- uses: actions/upload-artifact@v4 if: always() with: name: jest path: | coverage report