jest-module-proxy

1.0.0 • Public • Published

jest-module-proxy · npm Build Status codecov

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

Package Sidebar

Install

npm i jest-module-proxy

Weekly Downloads

59

Version

1.0.0

License

MIT

Unpacked Size

5.58 kB

Total Files

12

Last publish

Collaborators

  • vlad-zhukov