diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index afeb689..d3870e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,17 +41,17 @@ jobs: - name: Lint id: npm-lint run: npm run lint - # - name: Test - # id: npm-ci-test - # run: npm run ci-test + + - name: Test + id: npm-ci-test + run: npm run ci-test test-attest: name: Test attest action runs-on: ubuntu-latest permissions: - contents: read + contents: write id-token: write - packages: write env: SUBJECT: /repos/${{ github.repository }}/tarball/${{ github.sha }} steps: diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index 5ccc623..a9dbbb5 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -21,6 +21,9 @@ const getBooleanInputMock = jest.spyOn(core, 'getBooleanInput') const setOutputMock = jest.spyOn(core, 'setOutput') const setFailedMock = jest.spyOn(core, 'setFailed') +// Ensure that setFailed doesn't set an exit code during tests +setFailedMock.mockImplementation(() => {}) + const summaryWriteMock = jest.spyOn(core.summary, 'write') summaryWriteMock.mockImplementation(async () => Promise.resolve(core.summary)) diff --git a/jest.setup.js b/jest.setup.js new file mode 100644 index 0000000..a535bd6 --- /dev/null +++ b/jest.setup.js @@ -0,0 +1 @@ +process.stdout.write = jest.fn() diff --git a/package.json b/package.json index 953251a..46994f6 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,9 @@ "license": "MIT", "jest": { "preset": "ts-jest", + "setupFilesAfterEnv": [ + "./jest.setup.js" + ], "verbose": true, "clearMocks": true, "testEnvironment": "node",