MOXY's set of Jest configuration packages to be used across several JavaScript projects.
This package contains two sets of Jest configurations to be used in JavaScript projects:
- the base configuration, which defines standard settings to be shared by all projects.
- the enhancers, which contain settings targeted to specific testing frameworks and enviroments, such as: browsers, React Native, Enzyme, Testing Library, etc..
For more information on how to use each package and their respective configurations, please refer to the READMEs by following the links below. You may also check the examples listed in Typical configs below to see learn how the packages may be combined for the most common scenarios.
The base config is published as @moxy/jest-config-base
. Check out its README to learn how to use it.
There are several enhancer packages, which are intended to be used in conjunction with the base configuration:
@moxy/jest-config-web
- If you're developing a web project.@moxy/jest-config-react-native
- If you're developing a React Native app.@moxy/jest-config-enzyme
- If you're using Enzyme framework.@moxy/jest-config-testing-library
- If you're using React Testing Library (RTL) or Native Testing Library (NTL) frameworks.
Node.js project
'use strict';
const { baseConfig } = require('@moxy/jest-config-base');
module.exports = baseConfig('node');
Web project with RTL
'use strict';
const { compose, baseConfig } = require('@moxy/jest-config-base');
const withWeb = require('@moxy/jest-config-web');
const { withRTL } = require('@moxy/jest-config-testing-library');
module.exports = compose(
baseConfig(),
withWeb(),
withRTL(), // ⚠️ Always after .withWeb
);
Web project with Enzyme
'use strict';
const { compose, baseConfig } = require('@moxy/jest-config-base');
const withWeb = require('@moxy/jest-config-web');
const { withEnzymeWeb } = require('@moxy/jest-config-enzyme');
module.exports = compose(
baseConfig(),
withWeb(),
withEnzymeWeb('enzyme-adapter-react-16'), // ⚠️ Always after .withWeb
);
React Native project with NTL
'use strict';
const { compose, baseConfig } = require('@moxy/jest-config-base');
const withReactNative = require('@moxy/jest-config-react-native');
const { withNTL } = require('@moxy/jest-config-testing-library');
module.exports = compose(
baseConfig('node'),
withReactNative(),
withNTL(), // ⚠️ Always after .withReactNative
);
React Native project with Enzyme
'use strict';
const { compose, baseConfig } = require('@moxy/jest-config-base');
const withReactNative = require('@moxy/jest-config-react-native');
const { withEnzymeReactNative } = require('@moxy/jest-config-enzyme');
module.exports = compose(
baseConfig(),
withReactNative(),
withEnzymeReactNative('enzyme-adapter-react-16'), // ⚠️ Always after .withReactNative
);
If you want to read the change log of an older version, please check here.
Released under the MIT License.