Closed serut closed 3 years ago
You can reproduce using :
git clone https://github.com/serut/regards-frontend-webpack-5
cd webapp
npm i
npm run test:mocha
Webpack config is inside /webapp/webpack-config-front/src/app/webpack.test.config.js
Yep, tested and working with a large enterprise project.
Thanks for the repro. I'm getting a different error than you. Can you provide your instant-mocha
command?
Could it be that even though you installed instant-mocha
, you're still using mochapack
?
PS, this isn't a fork
Also seems like you upgraded to Webpack 5 without confirming that instant-mocha
is working. So the error you provided above is completely irrelevant to instant-mocha
.
instant-mocha
supports both Webpack 4 & 5. Please test in isolation with Webpack 4 if that was already working for you.
And if possible, please provide a minimal reproduction of the error.
With or without webpack 5 I have the same error (after fixing test cmd) :
Cannot find module 'chai'
Require stack:
- /main.js
- /home/leo/CS/rs-dev/regards-oss-frontend/webapp/node_modules/instant-mocha/dist/lib/memfs.js
- /home/leo/CS/rs-dev/regards-oss-frontend/webapp/node_modules/instant-mocha/dist/lib/mocha.js
- /home/leo/CS/rs-dev/regards-oss-frontend/webapp/node_modules/instant-mocha/dist/instant-mocha.js
- /home/leo/CS/rs-dev/regards-oss-frontend/webapp/node_modules/instant-mocha/dist/cli.js
- /home/leo/CS/rs-dev/regards-oss-frontend/webapp/node_modules/instant-mocha/bin/instant-mocha.js
npm ERR! code ELIFECYCLE
Sorry I thought it was a fork..
If I had /chai/,
to the whitelist inside externals: [nodeExternals
it founds chai, but then it's another dependency that's missing...
I removed externals
and module.noParse
from my webpack test conf to make it compiles. Now some mocks are not working anymore, but it looks like a lot of things are working as expected.
Congratz !
Now I've fixed my stub, the runner does not stop when finished (I'm still using Webpack 4).
The command just hangs with :
3082 passing (3s)
[mochawesome] Report JSON saved to /home/leo/CS/rs-dev/regards-oss-frontend/webapp/reports/mocha/mochawesome.json
[mochawesome] Report HTML saved to /home/leo/CS/rs-dev/regards-oss-frontend/webapp/reports/mocha/mochawesome.html
Edit: Same behavior with Webpack 5. I pushed a new branch feature/webpack5 : https://github.com/serut/regards-frontend-webpack-5/tree/feature/webpack5
Hello,
I struggle to use your fork with Webpack 5:
did you test with a real project ?