From c68c2101c254470055e8aa38730553d71a47bc7b Mon Sep 17 00:00:00 2001 From: Aiqiao Yan <55104035+aiqiaoy@users.noreply.github.com> Date: Tue, 16 Jun 2026 17:10:58 -0400 Subject: upgrade module to esm and update dependencies (#2463) * upgrade module to esm so I can update dependencies * fix ci failures --- __test__/retry-helper.test.ts | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) (limited to '__test__/retry-helper.test.ts') 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() }) -- cgit v1.2.3