fix(@effect/vitest): fix compatibility with Vitest 4.0 (#5976) by bxff · Pull Request #5980 · Effect-TS/effect

Type

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

This PR fixes an incompatibility with Vitest 4.0 in @effect/vitest.

Vitest 4.0 has removed (or changed) the onTestFinished method on the test context object, causing a TypeError: ctx?.onTestFinished is not a function.

The fix switches to using the top-level onTestFinished hook imported directly from vitest. This is the recommended approach in modern Vitest versions and is fully backward compatible with the current peer dependency (vitest: ^3.2.0), as this export has been available since Vitest 0.34.0.

Additionally, @effect/vitest's peerDependencies have been updated to explicitly support Vitest 4.x.

Related