Skip to content

fix: eval fails with vitest 4.1#287

Merged
c-ehrlich merged 2 commits intomainfrom
fix-4.1
Mar 16, 2026
Merged

fix: eval fails with vitest 4.1#287
c-ehrlich merged 2 commits intomainfrom
fix-4.1

Conversation

@c-ehrlich
Copy link
Copy Markdown
Collaborator

@c-ehrlich c-ehrlich commented Mar 16, 2026

Resolves #286

Vitest 4.1.0 changed suite hook signatures for beforeAll/afterAll: the first arg is now fixture context, and the internal suite object moved to the second arg. That broke axiom eval, which uses beforeAll(async (suite) => ...) and failed with FixtureParseError.

This PR makes eval hooks work on both Vitest 4.0.x and 4.1.x by normalizing the hook arguments in one small compatibility wrapper, while keeping the actual hook logic in explicit handleBeforeAll / handleAfterAll functions. It also makes the afterAll task status checks safer with task.meta.case?.status.

Context:

Vitest release: https://github.com/vitest-dev/vitest/releases/tag/v4.1.0
Upstream change: vitest-dev/vitest#9572
Related follow-up/error text: vitest-dev/vitest#9786


Note

Medium Risk
Moderate risk because it changes how beforeAll/afterAll hooks receive the Vitest suite object, which can affect evaluation initialization/finalization and reporting if the compatibility shim is wrong.

Overview
Fixes axiom eval running under Vitest 4.1 by adding a small compatibility wrapper (withCompatibleSuiteHook) that normalizes beforeAll/afterAll hook arguments across Vitest versions and refactors the hook bodies into handleBeforeAll/handleAfterAll.

Also hardens end-of-suite case counting by treating task.meta.case as optional (case?.status) to avoid crashes when case metadata is missing.

Written by Cursor Bugbot for commit c63e5f2. This will update automatically on new commits. Configure here.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 16, 2026

Open in StackBlitz

npm i https://pkg.pr.new/axiom@287

commit: c63e5f2

@c-ehrlich c-ehrlich merged commit 1f619b2 into main Mar 16, 2026
10 checks passed
@c-ehrlich c-ehrlich deleted the fix-4.1 branch March 16, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Evaluations fails on vitest 4.1.0

2 participants