enable unit tests in CI (#15)

Signed-off-by: Brian DeHamer <[email protected]>
This commit is contained in:
Brian DeHamer
2024-02-28 10:45:31 -08:00
committed by GitHub
parent 6bbf2f4ab0
commit 32049315c5
4 changed files with 12 additions and 5 deletions
+5 -5
View File
@@ -41,17 +41,17 @@ jobs:
- name: Lint - name: Lint
id: npm-lint id: npm-lint
run: npm run lint run: npm run lint
# - name: Test
# id: npm-ci-test - name: Test
# run: npm run ci-test id: npm-ci-test
run: npm run ci-test
test-attest: test-attest:
name: Test attest action name: Test attest action
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: read contents: write
id-token: write id-token: write
packages: write
env: env:
SUBJECT: /repos/${{ github.repository }}/tarball/${{ github.sha }} SUBJECT: /repos/${{ github.repository }}/tarball/${{ github.sha }}
steps: steps:
+3
View File
@@ -21,6 +21,9 @@ const getBooleanInputMock = jest.spyOn(core, 'getBooleanInput')
const setOutputMock = jest.spyOn(core, 'setOutput') const setOutputMock = jest.spyOn(core, 'setOutput')
const setFailedMock = jest.spyOn(core, 'setFailed') 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') const summaryWriteMock = jest.spyOn(core.summary, 'write')
summaryWriteMock.mockImplementation(async () => Promise.resolve(core.summary)) summaryWriteMock.mockImplementation(async () => Promise.resolve(core.summary))
+1
View File
@@ -0,0 +1 @@
process.stdout.write = jest.fn()
+3
View File
@@ -39,6 +39,9 @@
"license": "MIT", "license": "MIT",
"jest": { "jest": {
"preset": "ts-jest", "preset": "ts-jest",
"setupFilesAfterEnv": [
"./jest.setup.js"
],
"verbose": true, "verbose": true,
"clearMocks": true, "clearMocks": true,
"testEnvironment": "node", "testEnvironment": "node",