mercredi 4 mai 2016

Unit testing in React + Mocha + Enzyme i + Webpack - how to ignore imported files?

I'm trying to Unit Test React on the Front End in Mocha & Enzyme. The testing stops when Mocha gets into the app file and parses over import statements:

import 'script!jquery';
import 'script!what-input';
import 'script!foundation-sites';

I was able to ignore .css and .scss files in the package.json test command:

"test": "mocha --compilers js:babel-register --require ./test/client/test_helper.js --require ignore-styles --recursive",
"test/client:watch": "npm test -- --watch"

I'm not clear on how to ignore these import files, and if I'm going about this the wrong way. (I found the solution for ignore-styles here in Stack Overflow but not something like this.

The error I get:

module.js:341
    throw err;
    ^

Error: Cannot find module 'script!jquery'

New to Unit testing, any help appreciated.

Aucun commentaire:

Enregistrer un commentaire