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

Commit

Permalink
Merge pull request #47 from storybookjs/yann/fix-cjs-interop
Browse files Browse the repository at this point in the history
Fix cjs/esm interoperability
  • Loading branch information
yannbf authored Oct 4, 2023
2 parents 128dedf + bb206ef commit 415f6d3
Showing 1 changed file with 4 additions and 1 deletion.
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 };

0 comments on commit 415f6d3

Please sign in to comment.