0.0.3 • Published 3 years ago
mock-require-assets v0.0.3
mock-require-assets
Simple mocks for assets, e.g. - images, styles
Why
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.
Installation
npm install --save-dev mock-require-assetsUsage
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.
Mocha
Use the --require argument to the CLI.
mocha --require mock-require-assetsAva
Add it the ava.require in package.json.
{
...
"ava": {
"require": [
"mock-require-assets"
]
}
...
}