Webpack and testing in Mocha
If you have inline file to test in Mocha and Mocha is generating an error about not knowing what to do with it, or a parsing error. Add the following to the setup.js
import fs from 'fs';
require.extensions['.svg'] = function (module, filename) {
module.exports = fs.readFileSync(filename, 'utf8');
};
where svg can be the extension of your file names
Written by Angela
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Mocha
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#