mocha-webpack ignores my webpack.config.js?

275 Views Asked by At

I am using the npm 5.2.0 with mocha-webpack to run my tests. However, my webpack.config.js seem to be ignored as I get all kind of errors of Aliases not being used in my webpack.config.js file.

My package.json command:

"test:mocha": "mocha-webpack",

My mocha-webpack.opts:

--webpack-config webpack.config.js
--colors
--require ignore-styles
--require babel-core/register
--require jsdom-global/register
**/tests/*.test.js

My mocha-webpack.opts is being used as the error output is in red. I also tried with a

--webpack-config webpack.config-test.js

That contains only the required webpack stuff: babel en aliases, but the same errors appear.

Some of the errors:

Module not found: Error: Can't resolve 'Redux/actions' in '/CodeRepo/checklist/src/js'
resolve 'Redux/actions' in '/CodeRepo/checklist/src/js'
  Parsed request is a module

Module parse failed: /CodeRepo/buttons/iconTextButton.js Unexpected token (16:12)
You may need an appropriate loader to handle this file type.

Any idea how to solve this? (I followed the example on the net, and the npm mocha-webpack page, but couldn't get it solved).

0

There are 0 best solutions below