Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

chore: switch from Coveralls to Codecov (#5447)

Mark Wiemerf4e7e54eb285
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index de05b34d..139507e3 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -92,7 +92,7 @@ Then:
- This will run both Node.js-based and browser-based tests.
- Ultimately, your pull request will be built on our continuous integration servers ([GitHub Actions](https://github.com/mochajs/mocha/actions?query=workflow%3A%22Tests%22)).
The first step to ensuring these checks pass is to test on your own machine.
- - A coverage check will be sent to [Coveralls](https://coveralls.io/github/mochajs/mocha).
+ - When tests are run in CI, a coverage check is sent to [Codecov](https://app.codecov.io/gh/mochajs/mocha. You'll need to [add the Codecov GitHub app](https://app.codecov.io/login) to upload these results from your fork. This is recommended but not necessary to open a PR.
**A drop in code coverage % is considered a failed check**.
1. Commit your changes.
- Use a brief message on the first line, referencing a relevant issue (e.g. `closes #12345`).
diff --git a/.github/workflows/mocha.yml b/.github/workflows/mocha.yml
index a45e7173..3ed66966 100644
--- a/.github/workflows/mocha.yml
+++ b/.github/workflows/mocha.yml
@@ -13,6 +13,7 @@ on:
permissions:
contents: read
+ id-token: write # for Codecov OIDC
jobs:
lint:
@@ -46,6 +47,9 @@ jobs:
test-node-all:
name: Test ${{ matrix.test-part }} in all environments
+ permissions:
+ id-token: write # for Codecov OIDC
+ contents: read # for Codecov OIDC
# TODO: Restore "mocha-github-actions-reporter" style reporting without relying on third party module
uses: ./.github/workflows/npm-script.yml
needs: test-node-lts
@@ -71,16 +75,6 @@ jobs:
npm-script: test-node:${{ matrix.test-part }}
coverage: ${{ matrix.coverage }}
- test-node-upload-coverage:
- needs: test-node-all
- if: always()
- runs-on: ubuntu-latest
- steps:
- - name: Coveralls Finished
- uses: coverallsapp/github-action@v2
- with:
- parallel-finished: true
-
test-browser-local:
uses: ./.github/workflows/npm-script.yml
with:
diff --git a/.github/workflows/npm-script.yml b/.github/workflows/npm-script.yml
index f34b8952..0b862130 100644
--- a/.github/workflows/npm-script.yml
+++ b/.github/workflows/npm-script.yml
@@ -26,6 +26,7 @@ on:
permissions:
contents: read
+ id-token: write
jobs:
resolve-inputs:
@@ -73,12 +74,16 @@ jobs:
NODE_OPTIONS: '--trace-warnings'
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
+ # Generate and upload coverage, even if tests fail
- name: Generate coverage report
if: always() && inputs.coverage
run: npm run test-coverage-generate
- - name: Coveralls Parallel
+ # https://github.com/marketplace/actions/codecov
+ # https://app.codecov.io/gh/mochajs/mocha
+ - name: Upload coverage reports
if: always() && inputs.coverage
- uses: coverallsapp/github-action@v2
+ uses: codecov/codecov-action@v5
with:
- flag-name: run-${{ inputs.npm-script }}-${{ join(matrix.*, '-') }}
- parallel: true
+ fail_ci_if_error: true
+ use_oidc: true
+
diff --git a/README.md b/README.md
index c82fc76b..4a83e42b 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@
<a href="https://www.npmjs.com/package/mocha"><img src="https://img.shields.io/npm/v/mocha.svg" alt="NPM Version"></a>
<a href="https://github.com/mochajs/mocha"><img src="https://img.shields.io/node/v/mocha.svg" alt="Node Version"></a>
[![GitHub Actions Build Status](https://github.com/mochajs/mocha/actions/workflows/mocha.yml/badge.svg)](https://github.com/mochajs/mocha/actions/workflows/mocha.yml)
-<a href="https://coveralls.io/github/mochajs/mocha"><img src="https://coveralls.io/repos/github/mochajs/mocha/badge.svg" alt="Coverage Status"></a>
+<a href="https://codecov.io/gh/mochajs/mocha"><img src="https://codecov.io/gh/mochajs/mocha/branch/main/graph/badge.svg" alt="Codecov Coverage Status"></a>
</div>