jest-module-proxy
v1.0.0
Published
An identity object for mocking imports inside Jest tests.
Downloads
12
Maintainers
Readme
jest-module-proxy ·
An identity object for mocking imports inside Jest tests. A drop-in replacement for
identity-obj-proxy
that works with modern Babel.
Getting Started
yarn add -D jest-module-proxy
Add the following to your Jest config:
"moduleNameMapper": {
"\\.css$": "jest-module-proxy"
},
And for a React component like this:
import React from 'react';
import styles from './App.module.css';
export default () => (
<div className={styles.root}>
<h1 className={styles.hello}>Hello, world!</h1>
</div>
);
exports[`App renders correctly 1`] = `
<div
class="root"
>
<h1
class="hello"
>
Hello, world!
</h1>
</div>
`;