Jest

First install jest-reporters-html

npm install --save-dev jest-reporters-html

Then 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

Jest example

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: coverage

Or you can combine the HTML output with the coverage report:

// jest.config.js
module.exports = {
  reporters: ["default", ["jest-html-reporters", {publicPath: "./report"}]],
}
- run: npx vitest --coverage --reporter html
- uses: actions/upload-artifact@v4
  if: always()
  with:
      name: jest
      path: |
        coverage
        report