# jest-css-modules

> A Jest processor that prevents CSS module parse errors

Latest version **2.1.0** (published 2019-06-06) · ISC license · 0 weekly downloads

## Install

```sh
npm install jest-css-modules
pnpm add jest-css-modules
yarn add jest-css-modules
bun add jest-css-modules
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2019-06-06 |
| First published | 2015-10-10 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 75 |
| Author | Justin Sisley |
| Maintainers | justinsisley |
| Keywords | jest, css modules, react |

## Links

- npm: https://www.npmjs.com/package/jest-css-modules
- Repository: https://github.com/justinsisley/Jest-CSS-Modules
- Homepage: https://github.com/justinsisley/Jest-CSS-Modules#readme
- Issues: https://github.com/justinsisley/Jest-CSS-Modules/issues
- npm.io page: https://npm.io/package/jest-css-modules

## Dependencies (1)

- [identity-obj-proxy](https://npm.io/package/identity-obj-proxy.md) 3.0.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.1.0 (latest) — 2019-06-06
- 2.0.0 — 2019-03-31
- 1.1.0 — 2016-10-07
- 1.0.2 — 2016-04-28
- 1.0.1 — 2016-04-20
- 1.0.0 — 2015-10-10

## README

> Note: As of v2.0.0, this library is simply implementing [identity-obj-proxy](https://github.com/keyz/identity-obj-proxy).
> The [Jest documentation](https://jestjs.io/docs/en/webpack.html#mocking-css-modules) provides more details on using identity-obj-proxy to solve this problem directly, and I recommend that you use that library instead of this one.

# Jest CSS Modules
A [Jest](https://facebook.github.io/jest/) [script processor](https://facebook.github.io/jest/docs/en/configuration.html#transform-object-string-string) that prevents [CSS module](https://github.com/css-modules/css-modules) parse errors.

## Installation

```shell
npm install -D jest-css-modules
```

Update your package.json file's `jest` configuration:

```json
{
  "jest": {
    "moduleNameMapper": {
      "\\.(css|less|scss|sss|styl)$": "<rootDir>/node_modules/jest-css-modules"
    }
  }
}
```

Now, imports such as `import styles from './MyModule.css';` will pass through Jest without causing any pain.

Supports `.css`, `.less`, `.scss`, `.sss`, and `.styl` extensions.

> Note: If you continue to experience CSS module parsing errors after installing and configuring this library, try running jest with the `--no-cache` flag. Read the [Jest documentation on caching](https://jestjs.io/docs/en/cli#cache) for more details.

---
_Source: https://npm.io/package/jest-css-modules · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
