3.0.1 • Published 3 years ago

imitation v3.0.1

Weekly downloads
92
License
ISC
Repository
github
Last release
3 years ago

Imitation

A simple Jest moduleNameMapper for non-code imports. It helps for testing stuff like CSS Modules and images.

Usage with Jest

npm i --save-dev imitation

Then set it up in your jest.config.js file:

{
  "jest": {
    // ... other config
    "moduleNameMapper": {
      "\\.(svg|png|jpg)$": "imitation/images",
      "\\.(scss|css)$": "imitation/styles"
    }
  }
}

Stylesheet files (CSS/SCSS/Less) will resolve to proxies that return any classname as itself (eg. styles.base resolves to 'base').

Anything else (ie. images or fonts or whatever) will resolve to the string "imitated".

Authors

3.0.1

3 years ago

3.0.0

4 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago