Skip to content

Conversation

@will-stone
Copy link
Contributor

Thanks for this package! Something changed recently with Vitest and it's producing an error when a package doesn't use the exports field.

CleanShot 2025-07-29 at 11  37 11@2x

This error happens when using Vitest (not sure about Jest) in an ESM environment.
@will-stone
Copy link
Contributor Author

will-stone commented Jul 29, 2025

For those stumbling across this, here's how to fix it until this is merged and released:

// vitest.setup.ts

import {
  configMocks,
  mockAnimationsApi,
  mockIntersectionObserver,
  mockResizeObserver,
  // @ts-expect-error -- https://github.com/trurl-master/jsdom-testing-mocks/pull/66
} from "jsdom-testing-mocks/dist/esm/index.js"

@trurl-master trurl-master merged commit 65d321f into trurl-master:master Jul 30, 2025
2 checks passed
@will-stone will-stone deleted the patch-1 branch July 30, 2025 10:38
@trurl-master
Copy link
Owner

Thank you @will-stone ! Sorry for that

@will-stone
Copy link
Contributor Author

Thanks for the quick release @trurl-master 😄

@nickluger
Copy link

This seems to cause an import types issue with TS, but might be due to my TS version 5.8.3.

@will-stone
Copy link
Contributor Author

will-stone commented Jul 30, 2025

Ah, looks like the type needs adding too:

CleanShot 2025-07-30 at 11  50 15@2x

I'll add another PR in a sec...

@trurl-master
Copy link
Owner

@will-stone can you try now? :)

@will-stone
Copy link
Contributor Author

That did it. Thanks 🙂

@nickluger
Copy link

Types work now in my case, thank you @will-stone & @trurl-master!

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.

3 participants