Skip to content
This repository was archived by the owner on May 16, 2024. It is now read-only.
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
13 changes: 12 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ const expect: typeof expectPatched = instrument(
{ intercept: (_method, path) => path[0] !== 'expect' }
).expect;

expect.extend(matchers);
// @TODO: This should be reverted once https://github.com/testing-library/jest-dom/pull/438 is merged
// Some bundlers include an undefined `default` in the namespace import,
// or __esmodule (a boolean) which cause expect.extend to throw.
const validMatchers = { ...matchers };
Object.keys(validMatchers).forEach((matcherName) => {
const matcher = validMatchers[matcherName];
if (typeof matcher === 'undefined' || typeof matcher === 'boolean') {
delete validMatchers[matcherName];
}
});

expect.extend(validMatchers);

export { expect, jest };