Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions __tests__/setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { vi } from 'vitest'

// @actions/* v3+ packages ship as true ESM, whose module namespace objects are non-configurable
// by spec, making vi.spyOn fail with "Cannot redefine property". Spreading the real exports
// into a plain object gives Vitest a configurable target so spyOn works while keeping the
// original implementations for anything not explicitly mocked in a test.
// See: https://vitest.dev/guide/mocking/modules.html#jsdom-happy-dom-node
vi.mock('@actions/core', async (importOriginal) => {
const actual = await importOriginal<typeof import('@actions/core')>()
return { ...actual }
})

vi.mock('@actions/exec', async (importOriginal) => {
const actual = await importOriginal<typeof import('@actions/exec')>()
return { ...actual }
})
Loading
Loading