1
0
mirror of https://github.com/actions/setup-java.git synced 2026-04-20 01:28:42 +08:00

Refactor error handling and improve test logging for installers (#989)

* Refactor error handling for version not found cases across multiple installers

* Mock core.error in tests to suppress error logs

* fix(graalvm): improve error messages for EA version not found scenarios

* refactor(tests): update error messages for version not found scenarios

* fix(graalvm): enhance error messages for version not found scenarios

* fix(graalvm): improve error messages for version not found scenarios with updated download URL

* fix(graalvm): improve error handling for EA version not found scenarios with clearer messages
This commit is contained in:
Chiranjib Swain
2026-04-13 23:14:45 +05:30
committed by GitHub
parent 1d018f9b8b
commit 0756542bc5
34 changed files with 414 additions and 176 deletions

View File

@@ -17,6 +17,7 @@ describe('dependency cache', () => {
let spyWarning: jest.SpyInstance<void, Parameters<typeof core.warning>>;
let spyDebug: jest.SpyInstance<void, Parameters<typeof core.debug>>;
let spySaveState: jest.SpyInstance<void, Parameters<typeof core.saveState>>;
let spyCoreError: jest.SpyInstance;
beforeEach(() => {
workspace = mkdtempSync(join(tmpdir(), 'setup-java-cache-'));
@@ -51,6 +52,10 @@ describe('dependency cache', () => {
spySaveState = jest.spyOn(core, 'saveState');
spySaveState.mockImplementation(() => null);
// Mock core.error to suppress error logs
spyCoreError = jest.spyOn(core, 'error');
spyCoreError.mockImplementation(() => {});
});
afterEach(() => {
@@ -58,6 +63,10 @@ describe('dependency cache', () => {
process.env['GITHUB_WORKSPACE'] = ORIGINAL_GITHUB_WORKSPACE;
process.env['RUNNER_OS'] = ORIGINAL_RUNNER_OS;
resetState();
jest.resetAllMocks();
jest.clearAllMocks();
jest.restoreAllMocks();
});
describe('restore', () => {