jest-config-testing-library
MOXY's Jest configuration enhancer for:
- Web projects that use React Testing Library (RTL) framework.
- React Native apps that use Native Testing Library (NTL) framework.
Installation
$ npm install --save-dev jest @moxy/jest-config-base @moxy/jest-config-testing-library
This package should be used in conjunction with @moxy/jest-config-base
. There are two enhancers available:
withRTL
An enhancer for web projects tested with React Testing Library.
What's included?
- Extended matchers: Make assertions easier and clearer by using jest-dom.
Usage
To use this enhancer, use the compose
function that comes with this package. Keep in mind, the first item should always be the base configuration!
'use strict';
const { compose, baseConfig } = require('@moxy/jest-config-base');
const { withRTL } = require('@moxy/jest-config-testing-library');
module.exports = compose(
baseConfig(),
withRTL(),
);
withRTL
is composed only after withWeb
from @moxy/jest-config-web
.
withNTL
An enhancer for React Native apps tested with Native Testing Library.
What's included?
- Extended matchers: Make assertions easier and clearer by using jest-native.
Usage
To use this enhancer, use the compose
function that comes with this package. Keep in mind, the first item should always be the base configuration!
'use strict';
const { compose, baseConfig } = require('@moxy/jest-config-base');
const { withNTL } = require('@moxy/jest-config-testing-library');
module.exports = compose(
baseConfig('node'),
withNTL(),
);
withNTL
is composed only after withReactNative
from @moxy/jest-config-react-native
.