Refactor error handling and improve test logging for installers - #989
Merged
HarithaVattikuti merged 8 commits intoApr 13, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR standardizes “version not found” error handling across Java distribution installers by introducing a shared helper on JavaBase, and updates installer/caching tests to use the new message format while reducing noisy core.error output during test runs.
Changes:
- Added
JavaBase.createVersionNotFoundError(...)to generate consistent, context-rich error messages (with optional available-versions truncation). - Refactored multiple distribution installers to throw the standardized error instead of bespoke strings.
- Updated Jest suites to align assertions with the new messages and to consistently mock
core.errorto suppress test log noise.
Reviewed changes
Copilot reviewed 33 out of 34 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/distributions/base-installer.ts | Adds createVersionNotFoundError helper for standardized errors. |
| src/distributions/adopt/installer.ts | Uses the new helper when no satisfied version is found. |
| src/distributions/corretto/installer.ts | Uses the new helper when no satisfied version is found. |
| src/distributions/dragonwell/installer.ts | Uses the new helper when no satisfied version is found. |
| src/distributions/graalvm/installer.ts | Switches to the helper for some “not found” paths and appends a GraalVM URL hint on 404. |
| src/distributions/jetbrains/installer.ts | Uses the new helper when no satisfied version is found. |
| src/distributions/liberica/installer.ts | Uses the new helper when no satisfied version is found. |
| src/distributions/microsoft/installer.ts | Uses the new helper when no satisfied version is found (includes manifest versions). |
| src/distributions/oracle/installer.ts | Uses the new helper when no satisfied version is found. |
| src/distributions/sapmachine/installer.ts | Uses the new helper when no satisfied version is found. |
| src/distributions/semeru/installer.ts | Uses the new helper and adds platform context to the error. |
| src/distributions/temurin/installer.ts | Uses the new helper when no satisfied version is found. |
| src/distributions/zulu/installer.ts | Uses the new helper when no satisfied version is found. |
| dist/setup/index.js | Updates the compiled distribution bundle to reflect source changes. |
| tests/distributors/adopt-installer.test.ts | Mocks core.error to suppress logs during tests. |
| tests/distributors/base-installer.test.ts | Updates version-not-found expectations and adds unit tests for the helper. |
| tests/distributors/corretto-installer.test.ts | Mocks core.error to suppress logs during tests. |
| tests/distributors/dragonwell-installer.test.ts | Updates error expectations and mocks core.error. |
| tests/distributors/graalvm-installer.test.ts | Updates error expectations and removes assertions tied to old core.error logging behavior. |
| tests/distributors/jetbrains-installer.test.ts | Mocks core.error to suppress logs during tests. |
| tests/distributors/liberica-installer.test.ts | Updates error expectations and mocks core.error. |
| tests/distributors/liberica-linux-installer.test.ts | Updates error expectations and mocks core.error. |
| tests/distributors/liberica-windows-installer.test.ts | Updates error expectations and mocks core.error. |
| tests/distributors/local-installer.test.ts | Mocks core.error to suppress logs during tests. |
| tests/distributors/microsoft-installer.test.ts | Mocks core.error to suppress logs during tests. |
| tests/distributors/oracle-installer.test.ts | Mocks core.error to suppress logs during tests. |
| tests/distributors/sapmachine-installer.test.ts | Updates error expectations and mocks core.error. |
| tests/distributors/semeru-installer.test.ts | Mocks core.error to suppress logs during tests. |
| tests/distributors/temurin-installer.test.ts | Mocks core.error to suppress logs during tests. |
| tests/distributors/zulu-installer.test.ts | Updates error expectations and mocks core.error. |
| tests/distributors/zulu-linux-installer.test.ts | Updates error expectations and mocks core.error. |
| tests/distributors/zulu-windows-installer.test.ts | Updates error expectations and mocks core.error. |
| tests/cache.test.ts | Mocks core.error and strengthens cleanup of Jest mocks between tests. |
| tests/cleanup-java.test.ts | Mocks core.error and strengthens cleanup of Jest mocks between tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description:
This PR standardizes the “version not found” error handling across Java distribution installers by introducing a shared helper in JavaBase. It also updates installer and caching tests to align with the new message format and reduces noisy
core.erroroutput during test runs.Related issue:
#977, #978
Check list: