From ea8b747819ff6d82907eb4018229f1a75c174697 Mon Sep 17 00:00:00 2001 From: Varun Sharma Date: Thu, 7 Dec 2023 12:09:35 -0800 Subject: [PATCH] Publish test results (#363) * Publish test results * Update test.yml * Update test.yml * Update test.yml * Update test.yml --- .github/workflows/test.yml | 9 +++++++++ .gitignore | 1 + jest.config.ts | 8 ++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5edf76c7..598c1db2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,6 +13,9 @@ concurrency: group: ${{ github.workflow }} jobs: test: + permissions: + checks: write + pull-requests: write runs-on: ubuntu-latest steps: - name: Harden Runner @@ -35,3 +38,9 @@ jobs: - name: Run coverage run: npm test -- --coverage - uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 + - name: Publish Test Results + uses: step-security/publish-unit-test-result-action@v1 + if: always() + with: + files: | + reports/*.xml diff --git a/.gitignore b/.gitignore index ac65aa60..669d24ae 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ lib-cov # Coverage directory used by tools like istanbul coverage +reports *.lcov # nyc test coverage diff --git a/jest.config.ts b/jest.config.ts index e5841e93..61b68a18 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -1,5 +1,9 @@ /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ export default { - preset: 'ts-jest', - testEnvironment: 'node', + preset: "ts-jest", + testEnvironment: "node", + reporters: [ + "default", + ["jest-junit", { outputDirectory: "reports", outputName: "report.xml" }], + ], };