mirror of
https://github.com/actions/checkout.git
synced 2026-06-17 17:29:39 +00:00
upgrade module to esm and update dependencies (#2463)
* upgrade module to esm so I can update dependencies * fix ci failures
This commit is contained in:
@@ -1,16 +1,32 @@
|
||||
import * as core from '@actions/core'
|
||||
import {RetryHelper} from '../lib/retry-helper'
|
||||
import {
|
||||
jest,
|
||||
describe,
|
||||
it,
|
||||
expect,
|
||||
beforeAll,
|
||||
beforeEach,
|
||||
afterAll
|
||||
} from '@jest/globals'
|
||||
|
||||
let info: string[] = []
|
||||
|
||||
// Mock @actions/core before loading retry-helper
|
||||
jest.unstable_mockModule('@actions/core', () => ({
|
||||
info: jest.fn((message: string) => {
|
||||
info.push(message)
|
||||
}),
|
||||
debug: jest.fn(),
|
||||
warning: jest.fn(),
|
||||
error: jest.fn()
|
||||
}))
|
||||
|
||||
// Dynamic imports after mocking
|
||||
const {RetryHelper} = await import('../src/retry-helper.js')
|
||||
|
||||
let info: string[]
|
||||
let retryHelper: any
|
||||
|
||||
describe('retry-helper tests', () => {
|
||||
beforeAll(() => {
|
||||
// Mock @actions/core info()
|
||||
jest.spyOn(core, 'info').mockImplementation((message: string) => {
|
||||
info.push(message)
|
||||
})
|
||||
|
||||
retryHelper = new RetryHelper(3, 0, 0)
|
||||
})
|
||||
|
||||
@@ -20,7 +36,6 @@ describe('retry-helper tests', () => {
|
||||
})
|
||||
|
||||
afterAll(() => {
|
||||
// Restore
|
||||
jest.restoreAllMocks()
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user