Skip to content

Dependency Compatibility Fixes#24

Merged
themattspiral merged 6 commits into
mainfrom
deps-compat
May 8, 2026
Merged

Dependency Compatibility Fixes#24
themattspiral merged 6 commits into
mainfrom
deps-compat

Conversation

@themattspiral
Copy link
Copy Markdown
Owner

  • use exported ASC consts to address redefined const enum mismatch starting in assemblyscript 0.28.16
  • add compat logic for retry config (SerializedRetry) and highlight util changes in vitest 4.1.0
  • adapt types to non-generic CoverageOptions/ResolvedCoverageOptions types in vitest 4.1.1 (backwards compatible approach)
  • bump vitest to 4.1.5
  • pin assemblyscript to 0.28.16 (pre-binaryen update)

Refactoring

  • split coverage provider type augmentation per vitest major version

…mismatch starting in assemblyscript 0.28.16
…tions` types in vitest 4.1.1

vitest 4.1.1 flattened `CoverageOptions` and `ResolvedCoverageOptions`
from generic discriminated types into flat interfaces in PR
vitest-dev/vitest#9931.
`ResolvedCoverageOptions<'v8'>` is now a hard type error, and the new
flat `ResolvedCoverageOptions` requires more defaulted fields
(`enabled`, `clean`, `cleanOnRerun`, `reportsDirectory`, etc.).
  - Drop `<'v8'>` from `Omit<ResolvedCoverageOptions, 'provider'>` in
    `ResolvedHybridProviderOptions`, and from local annotations in
    `hybrid-coverage-provider.ts`. The hybrid type now structurally
    satisfies the new `CoverageProvider.resolveOptions()` return shape
  - Cast through `unknown` at the project-config to
    `ResolvedHybridProviderOptions` boundary in `pool-runner-init.ts`
    and `resolve-config.ts`. These casts were always partially unsafe
    (the old generic just hid it from TS)

Runtime contract is unchanged - `resolveOptions()` still spreads the
v8 provider's resolved options and adds our extras, so the returned
object satisfies both the old and new shapes at runtime.
…est major

Vitest 4.1.1 deprecated `CustomProviderOptions` in favor of augmenting
`CoverageOptions` directly. Switching the augmentation target wholesale
isn't possible while supporting v3, because v3's `CoverageOptions` is a
generic type alias. The only augmentation point that's an interface in
both v3 and v4 is `CustomProviderOptions`, which is why the previous
unified augmentation used it.

Split the augmentation per major so the right one loads only via the
matching entry point:
- Reshape `HybridProviderOptions` to contain only the AS-specific
  user-facing fields (`debugIstanbul`, `assemblyScriptInclude`,
  `assemblyScriptExclude`)
- `src/config/coverage-options.ts` - augments `CoverageOptions`,
  side-effect-loaded by the v4 entry (`./index.ts`)
- `src/config/custom-provider-options-v3.ts` (renamed from
  `custom-provider-options.ts`) - augments `CustomProviderOptions`,
  side-effect-loaded by the v3 entry (`./index-v3.ts`)
- Drop the side-effect import from `hybrid-coverage-provider.ts`;
  shared code must not pull a version-specific augmentation, since
  whichever it picked would break the other version's consumers
- Switch the internal cast in `hybrid-coverage-provider.ts` from
  `as CustomProviderOptions` to `as CoverageOptions`
- The custom-provider markers (`provider: 'custom'`,
  `customProviderModule`) are now inlined directly in
  `ResolvedHybridProviderOptions`, so both augmentation files can simply
  extend `HybridProviderOptions` without the v4 augmentation forcing
  `provider: 'custom'` onto vitest's flat `CoverageOptions` (which is
  shared across all provider types in v4.1.1+).

This is a type-only change - no runtime behavior is affected. Future
v3-removal will only require deleting `custom-provider-options-v3.ts`
and its import.
@themattspiral themattspiral self-assigned this May 8, 2026
@themattspiral themattspiral merged commit 36edbda into main May 8, 2026
2 checks passed
@themattspiral themattspiral deleted the deps-compat branch May 8, 2026 17:07
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

🎉 This PR is included in version 0.9.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant