Repository navigation
chore: upgrade vitest to v4 (coordinated with @vitest/coverage-v8 v4) - #1352
Merged
tamirdresher merged 4 commits intoJun 16, 2026
Merged
Conversation
Bumps [@vitest/coverage-v8](https://github.com/vitest-dev/vitest/tree/HEAD/packages/coverage-v8) from 3.2.4 to 4.1.9. - [Release notes](https://github.com/vitest-dev/vitest/releases) - [Changelog](https://github.com/vitest-dev/vitest/blob/main/docs/releases.md) - [Commits](https://github.com/vitest-dev/vitest/commits/v4.1.9/packages/coverage-v8) --- updated-dependencies: - dependency-name: "@vitest/coverage-v8" dependency-version: 4.1.9 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
…itest/coverage-v8 v4 Dependabot github#1337 bumped @vitest/coverage-v8 to ^4.1.9 but left vitest at ^3.0.0, causing ERESOLVE in CI. This commit aligns both packages at ^4.1.9 across root and all sample workspaces that referenced ^3.0.0. Vitest v4 API adaptations required: - test/cli/loop.test.ts: add vi.clearAllMocks() to afterEach — vitest 4 no longer resets vi.fn() call history on vi.restoreAllMocks(); the 'skips gh copilot preflight when agentCmd is provided' test was seeing stale execFile call counts from the prior test. - test/cli/watch-capabilities.test.ts: FSStorageProvider mock changed from vi.fn(() => mockStorage) to vi.fn(function() { return mockStorage; }) — vitest 4 spying rewrite requires 'function' keyword (not arrow function) for mocks used as constructors with 'new'. No changes to non-test, non-package-version code. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
🟡 Impact Analysis — PR #1352Risk tier: 🟡 MEDIUM 📊 Summary
🎯 Risk Factors
📦 Modules Affectedroot (7 files)
tests (7 files)
|
Contributor
🔒 Security Review🔒 Security review: 5 info.
Automated security review — informational only. |
Contributor
🛫 PR Readiness Check
PR Scope: 🔧 Infrastructure
|
| Status | Check | Details |
|---|---|---|
| ❌ | Single commit | 4 commits — consider squashing before review |
| ✅ | Not in draft | Ready for review |
| ✅ | Branch up to date | Up to date with dev |
| ❌ | Copilot review | No Copilot review yet — it may still be processing |
| ✅ | Changeset present | Changeset file found |
| ✅ | Scope clean | No .squad/ or docs/proposals/ files |
| ✅ | No merge conflicts | No merge conflicts |
| ❌ | Copilot threads resolved | 6 unresolved Copilot thread(s) — fix and resolve before merging |
| ❌ | CI passing | 7 check(s) still running |
Files Changed (14 files, +750 −1324)
| File | +/− |
|---|---|
.changeset/vitest-4-upgrade.md |
+6 −0 |
package-lock.json |
+710 −1291 |
package.json |
+2 −2 |
samples/autonomous-pipeline/package.json |
+1 −1 |
samples/cost-aware-router/package.json |
+1 −1 |
samples/hello-squad/package.json |
+1 −1 |
samples/hook-governance/package.json |
+1 −1 |
test/adapter-client.test.ts |
+3 −3 |
test/cli/loop.test.ts |
+1 −0 |
test/cli/watch-capabilities.test.ts |
+1 −1 |
test/client.test.ts |
+17 −15 |
test/integration.test.ts |
+3 −3 |
test/session-traces.test.ts |
+3 −3 |
test/state/squad-state-gaps.test.ts |
+0 −2 |
Total: +750 −1324
This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR upgrades the repo’s test toolchain from Vitest v3 to Vitest v4 (coordinated with @vitest/coverage-v8 v4) to resolve a CI peer-dependency conflict introduced by a prior dependency bump.
Changes:
- Bump
vitestand@vitest/coverage-v8to^4.1.9in the root devDependencies and bumpvitestto^4.1.9in several samplepackage.jsonfiles. - Apply small Vitest v4 compatibility tweaks in CLI tests (
vi.clearAllMocks()inafterEach, and a constructor-safe mock forFSStorageProvider). - Add a changeset documenting the upgrade.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
package.json |
Updates root devDependencies to Vitest v4 / coverage v4. |
package-lock.json |
Refreshes lockfile to the Vitest v4 dependency graph (including updated transitive deps like Vite). |
samples/autonomous-pipeline/package.json |
Bumps sample devDependency vitest to v4. |
samples/cost-aware-router/package.json |
Bumps sample devDependency vitest to v4. |
samples/hello-squad/package.json |
Bumps sample devDependency vitest to v4. |
samples/hook-governance/package.json |
Bumps sample devDependency vitest to v4. |
test/cli/loop.test.ts |
Clears mock call history between tests to match Vitest v4 behavior. |
test/cli/watch-capabilities.test.ts |
Updates a mock to be constructible under Vitest v4. |
.changeset/vitest-4-upgrade.md |
Adds release notes for the upgrade (needs wording adjustment per review). |
| "@bradygaster/squad-cli": patch | ||
| --- | ||
|
|
||
| Bump vitest from v3 to v4 alongside @vitest/coverage-v8 v4 to resolve peer-dep mismatch. Both packages now align at ^4.1.9 across root and all sample workspaces. No API adaptations required — vitest 4's spying rewrite is backwards-compatible for the mock/spyOn patterns used in this codebase. |
Comment on lines
17
to
20
| "devDependencies": { | ||
| "typescript": "^5.7.0", | ||
| "vitest": "^3.0.0" | ||
| "vitest": "^4.1.9" | ||
| }, |
Comment on lines
16
to
19
| "devDependencies": { | ||
| "typescript": "^5.7.0", | ||
| "vitest": "^3.0.0" | ||
| "vitest": "^4.1.9" | ||
| }, |
Comment on lines
14
to
18
| "devDependencies": { | ||
| "tsx": "^4.0.0", | ||
| "vitest": "^3.0.0", | ||
| "vitest": "^4.1.9", | ||
| "typescript": "^5.7.0" | ||
| } |
Comment on lines
14
to
18
| "devDependencies": { | ||
| "tsx": "^4.0.0", | ||
| "vitest": "^3.0.0", | ||
| "vitest": "^4.1.9", | ||
| "typescript": "^5.7.0" | ||
| } |
Comment on lines
+40
to
+48
| "@vitest/coverage-v8": "^4.1.9", | ||
| "cspell": "^9.7.0", | ||
| "eslint": "^10.5.0", | ||
| "eslint-plugin-n": "^18.1.0", | ||
| "highlight.js": "^11.11.1", | ||
| "markdown-it": "^14.2.0", | ||
| "markdownlint-cli2": "^0.22.1", | ||
| "typescript": "^6.0.3", | ||
| "vitest": "^3.0.0" | ||
| "vitest": "^4.1.9" |
Comment on lines
+40
to
+48
| "@vitest/coverage-v8": "^4.1.9", | ||
| "cspell": "^9.7.0", | ||
| "eslint": "^10.5.0", | ||
| "eslint-plugin-n": "^18.1.0", | ||
| "highlight.js": "^11.11.1", | ||
| "markdown-it": "^14.2.0", | ||
| "markdownlint-cli2": "^0.22.1", | ||
| "typescript": "^6.0.3", | ||
| "vitest": "^3.0.0" | ||
| "vitest": "^4.1.9" |
vitest 4 esbuild rejects duplicate imports (parseHistory was imported twice in squad-state-gaps.test.ts). vitest 4 vi.fn(arrow) is not callable as a constructor, so the CopilotClient mock needed a function() wrapper that assigns to his. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…integration Same pattern as adapter-client.test.ts: vitest 4 vi.fn(arrow) is not callable as a constructor (no [[Construct]] internal slot). All three files mock CopilotClient and instantiate it with 'new', so they need a function() wrapper that assigns to 'this'. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Jun 16, 2026
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.
chore: bump vitest from v3 to v4 (coordinated with @vitest/coverage-v8 v4)
Closes #1337
Problem
Dependabot #1337 bumped
@vitest/coverage-v8from3.2.4to4.1.9but leftvitestat^3.0.0, producing a peer-dependency conflict in CI:Fix
Bump
vitestto^4.1.9in all packages that referenced^3.0.0:package.json(root workspace)samples/autonomous-pipeline/package.jsonsamples/cost-aware-router/package.jsonsamples/hello-squad/package.jsonsamples/hook-governance/package.json(
samples/streaming-chatwas already at^4.1.9.)Vitest v4 API adaptations
Two test files required surgical fixes for vitest 4 behavioural changes:
test/cli/loop.test.ts—vi.clearAllMocks()added toafterEachVitest 4's spying rewrite no longer resets
vi.fn()call histories whenvi.restoreAllMocks()is called. The testskips gh copilot preflight when agentCmd is providedwas seeing staleexecFilecall counts carried over from the preceding test.test/cli/watch-capabilities.test.ts— constructor mock changed to usefunctionkeywordvi.fn(() => mockStorage)fails withTypeError: () => mockStorage is not a constructorin vitest 4 because arrow functions cannot be invoked withnew. Changed tovi.fn(function() { return mockStorage; }).Testing
npm run build✅npm run lint✅npx vitest run test/cli/ test/integration.test.ts— 542 passed, 2 failed (both Windows-known flakes:state-mcp.test.tstimeout,team-root-resolution.test.tspath issue)