Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Fix cjs/esm interoperability #47

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ const expect = instrument(
{ intercept: (_method, path) => path[0] !== 'expect' }
).expect as unknown as Expect;

expect.extend(matchers);

// This is a workaround needed for CJS/ESM interop, to make both Vite and Webpack work, in CJS and ESM, without warnings.
const name = 'default' // we need to trick Webpack, this is how 🎉
expect.extend(matchers?.[name] ?? matchers);

export { expect, jest };