mirror of
https://gitea.com/actions/setup-java.git
synced 2026-04-19 05:32:00 +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:
@@ -11,19 +11,32 @@ describe('cleanup', () => {
|
||||
Parameters<typeof cache.saveCache>
|
||||
>;
|
||||
let spyJobStatusSuccess: jest.SpyInstance;
|
||||
let spyCoreError: jest.SpyInstance;
|
||||
|
||||
beforeEach(() => {
|
||||
spyWarning = jest.spyOn(core, 'warning');
|
||||
spyWarning.mockImplementation(() => null);
|
||||
|
||||
spyInfo = jest.spyOn(core, 'info');
|
||||
spyInfo.mockImplementation(() => null);
|
||||
|
||||
spyCacheSave = jest.spyOn(cache, 'saveCache');
|
||||
|
||||
spyJobStatusSuccess = jest.spyOn(util, 'isJobStatusSuccess');
|
||||
spyJobStatusSuccess.mockReturnValue(true);
|
||||
|
||||
// Mock core.error to suppress error logs
|
||||
spyCoreError = jest.spyOn(core, 'error');
|
||||
spyCoreError.mockImplementation(() => {});
|
||||
|
||||
createStateForSuccessfulRestore();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
resetState();
|
||||
jest.resetAllMocks();
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('does not fail nor warn even when the save process throws a ReserveCacheError', async () => {
|
||||
|
||||
Reference in New Issue
Block a user