Add TypeScript unit tests and Cobertura coverage reporting with CI upload - #172
Open
remyleone with code-coverage-agent[bot] wants to merge 2 commits into
Open
Add TypeScript unit tests and Cobertura coverage reporting with CI upload#172remyleone with code-coverage-agent[bot] wants to merge 2 commits into
remyleone with code-coverage-agent[bot] wants to merge 2 commits into
Conversation
Co-authored-by: remyleone <300834+remyleone@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No test infrastructure existed; coverage reporting was impossible. This adds vitest-based unit tests and integrates Cobertura XML coverage into the CI pipeline.
Coverage configuration
vitest.config.ts— V8 provider, Cobertura reporter output tocoverage/(gitignored)package.json—test→vitest run,test:coverage→vitest run --coverageUnit tests (
src/__tests__/)version.test.ts—VERSION_LATESTconstantinput.test.ts—validateArgswithlatest, explicit semver, and invalid version stringsconfig.test.ts—exportConfigenv var exports andimportConfigenv var readsrun.test.ts—CLIErrorshape, non-zero exit →CLIError, shell-operator injection →Errorcli.test.ts—fillEnvsets/skips env vars based on arg presenceCI integration (
.github/workflows/test.yml)Augmented the existing
lintjob — tests already share the install/build steps:New
upload-coverage-typescriptjob (elevatedcode-quality: write, fork-gated) downloads the artifact and callsactions/upload-code-coverage@v1.ESLint
Added a test-file override in
.eslintrcdisablingimport/first,import/order, and@typescript-eslint/require-await— required for vitest'svi.mock()hoisting pattern.