@empathyco/x-jest-utils

Jest extensions for easier testing.

Usage no npm install needed!

<script type="module">
  import empathycoXJestUtils from 'https://cdn.skypack.dev/@empathyco/x-jest-utils';
</script>

README

x-jest-utils

Jest extensions for easier testing.

How to install

npm install @empathyco/x-jest-utils --save-dev

How to use

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.

How to update the version

You can check if a new version has been published running npm outdated:

npm outdated @empathyco/x-jest-utils

And update it using npm update:

npm update --save @empathyco/x-jest-utils