Fix: Run the unit:integrations vitest project in CI and de-rot its version test - #245
Fix: Run the unit:integrations vitest project in CI and de-rot its version test#245AmaadMartin wants to merge 1 commit into
Conversation
… test vitest.config.ts declares six projects, but the `test`, `test:unit` and `test:coverage` scripts enumerate the unit projects by hand and omitted `unit:integrations`. CI runs `test:coverage`, so `integrations/test/**/*_test.ts` was never executed by .github/workflows/validation.yaml and the entire integrations test surface was dark. Add `unit:integrations` to those three scripts, ordered to match the project declaration order in vitest.config.ts. `test:integration`, `test:e2e` and `test:cross-language` are deliberate single-project entry points and are left alone; `cross-language` stays out of the default suite because it needs a Go toolchain and has its own workflow. Then repair the test that rotted while nobody was running it. It asserted a hardcoded '1.3.0' against an export release-please had already bumped to '1.4.0'. Derive the expectation from integrations/package.json at runtime instead: release-please rewrites the manifest and src/version.ts in the same release commit, so the manifest is a self-maintaining oracle and the literal cannot drift again. A second assertion checks semver shape, which catches the degenerate case where both files drift together into something that is not a version at all. Coverage thresholds are unaffected. No production code, public API or dependency changes.
d2ef13d to
72013d3
Compare
|
Heads-up for whoever reviews these: this PR and #236 are duplicates — both wire The only substantive differences are that this PR reads the manifest with They conflict on both files, so only one should land. #236 was opened first (2026-07-29T09:55:08Z vs 2026-07-29T12:15:53Z). Filing this as a cross-reference only — no opinion here on which one you keep. |
|
Closing as a duplicate of #236, which lands the same change and was opened first (2026-07-29T09:55:08Z vs 12:15:53Z here). Both PRs make the identical, byte-for-byte edit to the three root test scripts (
I verified #236's approach locally rather than assuming: it typechecks under the repo's #236 is also the base of a live stack — #311 (wildcard |
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
No existing issue.
Problem:
vitest.config.tsdeclares six projects (unit:core,unit:dev,unit:integrations,integration,e2e,cross-language), but the testscripts in the root
package.jsonenumerate the unit projects by hand andomitted
unit:integrations:testunit:core,unit:dev,integration,e2etest:unitunit:core,unit:devtest:coverageunit:core,unit:dev,integration,e2e(+--coverage).github/workflows/validation.yamlruns exactly one test command,npm run test:coverage, sointegrations/test/**/*_test.tswas never executedby CI.
unit:integrationswas the only declared project that no script and noworkflow ran. (
cross-languageis intentionally excluded from the defaultsuite — it needs a Go toolchain and has its own workflow,
.github/workflows/cross-language-integration.yml.)That dark corner then rotted.
integrations/test/version_test.tsasserted ahardcoded
expect(version).toBe('1.3.0')whileintegrations/src/version.tshad already been bumped to
1.4.0, so theintegrationsworkspace's only unittest failed the moment it was run — invisibly, because nothing ran it.
Solution:
Add
--project unit:integrationstotest,test:unitandtest:coverage, positioned afterunit:devso the ordering matches theproject declaration order in
vitest.config.ts.test:integration,test:e2eandtest:cross-languageare deliberate single-project entrypoints and are unchanged.
integrations/test/**/*_test.tsis now enforced onevery push and PR via
validation.yaml, across all three OS matrix legs.Rewrite the assertion in
integrations/test/version_test.tsso it cannot rotagain.
release-please-config.jsonregistersintegrations/src/version.tsas a generic
extra-filestarget and uses thenode-workspace+linked-versionsplugins, so every release rewrites both that literal andthe
versionfield ofintegrations/package.jsonin the same commit. Anyhardcoded literal in the test is therefore guaranteed to rot at the next
release. The test now reads
integrations/package.jsonat runtime andasserts equality against it, making the manifest a self-maintaining oracle.
A second assertion checks semver shape. The equality check catches a partial
release that bumps one file but not the other; the shape check catches the
degenerate case where both drift together into something that is not a
version at all.
resolveJsonModuleis not enabled anywhere in the tsconfig chain, so themanifest is read with
readFileSync(new URL('../package.json', import.meta.url))rather than a JSONimport, which would not typecheck.Coverage thresholds: unchanged.
vitest.config.tsis not touched by thisPR. Running
unit:integrationsmovesintegrations/src/version.tsandindex.tsfrom the uncovered into the covered column (Vitest'scoverage.allalready counted those 22 lines in the denominator), so the numbers move up, not
down. Verified on a full CI
npm run test:coveragerun of this branch:All filesreported 90.14 % statements / 88.95 % branches / 91.04 %functions / 90.14 % lines, comfortably above the committed thresholds of
86 / 87 / 88 / 86. CI confirms the project now runs:
✓ unit:integrations integrations/test/version_test.ts (2 tests)on all threeOS legs.
No production code, public API, or dependency changes — no file under any
src/directory is modified. Exactly two files change.Note on a pre-existing, unrelated local failure.
dev/test/cli/cli_create_test.ts→'should handle Vertex AI selection with gcloud defaults'fails on machines that have a localgcloudconfigurationexported (
createAgent()prefersGOOGLE_CLOUD_PROJECT/GOOGLE_CLOUD_LOCATIONover the mockedgcloud config get-valueoutput, andthe suite does not isolate
process.env). It lives inunit:dev, which CIalready ran before this change, so it is pre-existing and out of scope here; it
passes in CI, where those variables are unset. Left untouched deliberately —
not skipped, not deleted.
Testing Plan
Please describe the tests that you ran to verify your changes. This is required for all PRs that are not small documentation or typo fixes.
Unit Tests:
[x] I have added or updated unit tests for my change.
[x] All unit tests pass locally.
The single failure is the pre-existing
cli_create_test.tsgcloud-dependentcase described above; it is untouched by this diff and reproduces identically
without these changes.
Negative tests — proving the new assertions actually guard:
The semver pattern was checked against real release-please output shapes so it
cannot false-positive and block a release:
1.4.0,1.4.0-alpha.1,1.5.0-rc-1and1.4.0+build.3all match;not-a-versionand1.4do not.Lint / format / license:
Manual End-to-End (E2E) Tests:
Simulate a release-please bump and confirm the test no longer rots. Under the
old hardcoded assertion this scenario failed; it now passes, which is the whole
point of the change.
Checklist
[x] I have read the CONTRIBUTING.md document.
[x] I have performed a self-review of my own code.
[x] I have commented my code, particularly in hard-to-understand areas.
[x] I have added tests that prove my fix is effective or that my feature works.
[x] New and existing unit tests pass locally with my changes.