diff --git a/.gitea/workflows/run-tests.yaml b/.gitea/workflows/run-tests.yaml index 7326e84..2fa6bdd 100644 --- a/.gitea/workflows/run-tests.yaml +++ b/.gitea/workflows/run-tests.yaml @@ -177,14 +177,42 @@ jobs: # Run all top-level test_*.js files (skips integration/ and satloc/ sub-dirs # which are covered by the jest-integration job or need live connections). - - name: Run Mocha unit tests (tests/) + # Coverage is aggregated across this run and tests/utils/. + - name: Run Mocha unit tests with coverage run: | - npx mocha --exit --timeout 120000 \ - --require tests/setup.js \ - 'tests/test_*.js' - continue-on-error: false + set -o pipefail + rm -rf .nyc_output coverage/mocha mocha-unit.log - # Run Mocha tests in tests/utils/ - - name: Run Mocha utility tests (tests/utils/) - run: npm run test:utils - continue-on-error: false + npx nyc \ + --silent \ + --temp-dir .nyc_output \ + npx mocha --exit --timeout 120000 \ + --require tests/setup.js \ + 'tests/test_*.js' 2>&1 | tee mocha-unit.log + + npx nyc \ + --silent \ + --temp-dir .nyc_output \ + --no-clean \ + npm run test:utils 2>&1 | tee -a mocha-unit.log + + npx nyc report \ + --temp-dir .nyc_output \ + --report-dir coverage/mocha \ + --reporter=text \ + --reporter=lcov \ + --reporter=json-summary | tee -a mocha-unit.log + + - name: Upload Mocha results + if: always() + uses: actions/upload-artifact@v3 + with: + name: mocha-unit-results + path: Development/server/mocha-unit.log + + - name: Upload Mocha coverage + if: always() + uses: actions/upload-artifact@v3 + with: + name: mocha-unit-coverage + path: Development/server/coverage/mocha