New Node Package: Imitation

I just published Imitation, a new Node package that helps with testing React components (especially those using CSS modules).

The most common use case is simply for mocking out image/css requires.

For example, say you have a component:

If you were to simply use something like Enzyme then it would fail when trying to require the css and image files.

That's where Imitation comes in. It hooks into the default require and injects a simple mock for images and css (images resolve to their own path and css resolves to a Proxy object where all custom properties resolve to just their name).

Imitation also has some methods for mocking URLs (for testing Redux Actions, etc) but I'll let you check them out in the README.