Jest extensions for easier testing.
# or pnpm or yarn
npm install @empathyco/x-jest-utils --save-dev
To register the extended matchers, just import the package in your tests. The recommended way to do so is using the setupFilesAfterEnv option from your Jest config file.
// File jest.config.js
module.exports = {
setupFilesAfterEnv: ['./tests.setup.js'],
testMatch: ['<rootDir>/**/*.spec.js']
};
// File tests.setup.js
import '@empathyco/x-jest-utils';
If you want to find out all the matchers, check the src/jest-utils.types.ts file.