Read-only mirror — the public repositories of the Forgejo instance, refreshed every 10 minutes. The live instance (fg.dieschoenewolke.de) is reachable only over the VPN; clone here with https://git.dieschoenewolke.de/git/<owner>/<repo>.git.
summaryrefslogtreecommitdiff
path: root/__test__/retry-helper.test.ts
diff options
context:
space:
mode:
authorAiqiao Yan <55104035+aiqiaoy@users.noreply.github.com>2026-06-16 17:10:58 -0400
committerGitHub <noreply@github.com>2026-06-16 17:10:58 -0400
commitc68c2101c254470055e8aa38730553d71a47bc7b (patch)
tree3d9a1c982fc2d3aed23e80a58d221942ac249155 /__test__/retry-helper.test.ts
parent6e97fb5586f435ba4f325b363a1c7329470cebf6 (diff)
upgrade module to esm and update dependencies (#2463)
* upgrade module to esm so I can update dependencies * fix ci failures
Diffstat (limited to '__test__/retry-helper.test.ts')
-rw-r--r--__test__/retry-helper.test.ts33
1 files changed, 24 insertions, 9 deletions
diff --git a/__test__/retry-helper.test.ts b/__test__/retry-helper.test.ts
index a5d3f79..2cd5026 100644
--- a/__test__/retry-helper.test.ts
+++ b/__test__/retry-helper.test.ts
@@ -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()
})