Simple mocks for assets, e.g. - images, styles
With tools like Webpack, React Native packager etc. allowing you to require all kinds of files like images, testing becomes more difficult as you've to now manually mock your assets. You can just throw this module in and let it do the magic.
npm install --save-dev mock-require-assets
Require mock-require-assets
with your test runner. You can also require mock-require-assets/images
or mock-require-assets/styles
to mock only images and stylesheets specifically.
Use the --require
argument to the CLI.
mocha --require mock-require-assets
Add it the ava.require
in package.json
.
{
...
"ava": {
"require": [
"mock-require-assets"
]
}
...
}