1.0.0-beta.1 • Published 3 years ago
@isfawwaz/jest-config-base v1.0.0-beta.1
@isfawwaz/jest-config-base
Shared Jest base configuration for my projects.
Installation
npm install --save-dev @isfawwaz/jest-config-base
# or
pnpm add -D @isfawwaz/jest-config-base
# or
yarn add -D @isfawwaz/jest-config-baseUsage
Create jest.config.js at the root of your project:
const { baseConfig } = require('@isfawwaz/jest-config-base');
module.exports = baseConfig();The baseConfig function accepts an optional parameter that allows to specify the Jest environment, which can be jsdom (default) or node. As an example, for Node.js projects you would use like so:
const { baseConfig } = require('@isfawwaz/jest-config-base');
module.exports = baseConfig('node');If you want to modify the base config, you may change the config imperatively like so:
'use strict';
const { baseConfig } = require('@isfawwaz/jest-config-base');
const config = baseConfig();
// Do not test `.data.js` files
config.testPathIgnorePatterns = [...config.testPathIgnorePatterns, '/.*.data.js$/'];
module.exports = config;