@moxy/jest-config-react-native

MOXY's Jest configuration enhancer for React Native apps


Keywords
jest-config, jestconfig, jest, test, preset, react-native
License
MIT
Install
npm install @moxy/jest-config-react-native@5.2.0

Documentation

jest-config

Build Status Coverage Status

MOXY's set of Jest configuration packages to be used across several JavaScript projects.

How it works

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.

Base config

The base config is published as @moxy/jest-config-base. Check out its README to learn how to use it.

Enhancer configs

There are several enhancer packages, which are intended to be used in conjunction with the base configuration:

Typical configs

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
);

Older versions

If you want to read the change log of an older version, please check here.

License

Released under the MIT License.