--watch switch doesn't restart tests #11
Replies: 2 comments 5 replies
-
I have one additional observation: If I have an error in the changed javascript code, I get the error message from webpack after the screen (terminal window) blanks. As soon as I correct it, the screen stays blank. So webpack updates the bundle (or tries to) apparently. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your question! Seeing you're on Webpack 5 now, I'm curious if it could be a WP 5 issue (although you did mention the first build works...). Have you confirmed your Webpack 5 upgrade was successful in an isolated environment? When migrating to instant-mocha for the Webpack 4 -> 5 upgrade, I recommend setting up instant-mocha with Webpack 4 first, making sure everything works, then upgrading to Webpack 5. Also, do you mind sharing your full Webpack config? Alternatively, if you can duplicate your repo and remove everything sensitive, and push it to a new repo as a minimal reproduction of the problem, that would work best for me. |
Beta Was this translation helpful? Give feedback.
-
Hi!
Introduction
Thanks for instant-mocha!
After upgrading webpack, it (almost, see below) flawlessly took on the job of mocha-webpack.
I have just one problem, which is that the
--watch
flag doesn't work for me. I decided to start to post here before reporting an issue, since I'm not sure that I'm doing everything correctly.Sadly the project itself is in a private github repository, but I'll try to share as much as I can:
I'm starting the tests with
cross-env BABEL_ENV=test instant-mocha --colors --require jsdom-global/register --require ignore-styles --require core-js/stable --require regenerator-runtime/runtime --webpack-config webpack.config.tests.js airshield/js/tests/
and thetest-watch
scriptlet puts the--watch
flag at the end.However if I start tests on the commandline with
BABEL_ENV=test ./node_modules/.bin/instant-mocha --watch --colors --require jsdom-global/register --require ignore-styles --require core-js/stable --require regenerator-runtime/runtime --webpack-config webpack.config.tests.js airshield/js/tests/
(putting the--watch
flag directly after the command), the behaviour is identical.What do I expect to see:
Tests should restart when I change a javascript file.
What happens instead:
The screen clears but no tests are run.
Setup
package.json
Here's my package.json:
webpack.config.js
:webpack.config.tests.js
:.babelrc
:Not sure if I missed anything. The point is that the tests are running
the first time (correctly) but the watch flag just causes the screen
to clear and nothing else.
Best Regards and thanks in advance for your help!
Friedel
Beta Was this translation helpful? Give feedback.
All reactions