Skip to content

fix: resolve vitest-qase-reporter type declarations on Vitest 5 - #1025

Open
gibiw wants to merge 1 commit into
mainfrom
fix/vitest-5-types
Open

gibiw wants to merge 1 commit into
mainfrom
fix/vitest-5-types

Conversation

@gibiw

@gibiw gibiw commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Summary

[email protected] runs fine on Vitest 5, but its type declarations break: Vitest 5 removed the vitest/reporters subpath and no longer installs @vitest/runner as a separate package. TypeScript projects with skipLibCheck: false fail with TS2307 when importing vitest-qase-reporter.

  • Reporter is now imported from vitest/node (merged with the existing TestCase/TestSuite import)
  • TestAnnotation is now imported from vitest
  • Both are type-only imports, so the emitted JS is identical — runtime behaviour is unchanged
  • vitest devDependency bumped ^4.1.11 → ^5.0.2 (5.0.3 is still inside the repo's min-release-age=3 window); peerDependencies stays >=3.0.0
  • README requirements: Node >=18 (matches engines), Vitest >=3.0.0 (tested with 3.x, 4.x and 5.x)
  • Version bumped to 1.5.1, changelog entry added

Verification

Packed [email protected] and ran examples/single/vitest in report mode against each Vitest version:

Vitest Test run Qase report Consumer tsc (skipLibCheck: false)
3.2.7 23 passed / 2 failed / 3 skipped 28 results, 37 steps, 3 attachments no errors in reporter d.ts
4.1.11 23 passed / 2 failed / 3 skipped 28 results no errors in reporter d.ts
5.0.3 23 passed / 2 failed / 3 skipped 28 results no errors in reporter d.ts (1.5.0: 2× TS2307)

The 2 failures are intentional in the example. In package: npm run build, npm run lint (0 errors), npm test (76/76) pass with Vitest 5.0.2.

Not addressed

qase-javascript-commons/dist/options/composeOptions.d.ts references MergeWithCustomizer (lodash types), which fails tsc with skipLibCheck: false on every Vitest version. It is a pre-existing commons issue affecting all reporters and is left for a separate fix.

Vitest 5 removed the `vitest/reporters` subpath and no longer installs
`@vitest/runner` as a separate package. The reporter imported `Reporter`
and `TestAnnotation` from those modules, so the published `.d.ts` failed
with TS2307 in consumer projects using `skipLibCheck: false`.

Import `Reporter` from `vitest/node` and `TestAnnotation` from `vitest`;
both are exported there in Vitest 3, 4 and 5. The imports are type-only,
so runtime behaviour is unchanged.

Also bump the `vitest` devDependency to `^5.0.2` (5.0.3 is still inside
the repo's `min-release-age` window), update the README requirements,
and bump the package to 1.5.1.
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.

1 participant