Skip to content

Latest commit

 

History

History

jest-config-web

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

jest-config-web

NPM version Downloads Dependency status Dev Dependency status

MOXY's Jest configuration enhancer for Web projects.

Installation

$ npm install --save-dev jest @moxy/jest-config-base @moxy/jest-config-web

This package should be used in conjunction with @moxy/jest-config-base.

What's included?

  • Transform: Allows importing common files used for the web, such as fonts, images and videos. It also maps files ending in .data-url.<ext> and .inline.<ext> into their base64 data URL and raw content respectively, a convention we are using in next-with-moxy and other Webpack based projects.
  • Module name mapping: Maps .css files to an identity object, to correctly mock className lookups when using CSS Modules.

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!

const { compose, baseConfig } = require('@moxy/jest-config-base');
const withWeb = require('@moxy/jest-config-web');

module.exports = compose(
    baseConfig(),
    withWeb(),
);