-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--watch and .only conflict #888
Comments
I just experienced this... |
ugh.... really want to remove |
what do you suggest instead? using another tool like grunt,js watch? |
@benjamine I use nodemon for things that don't have a |
yes, I suppose some could get furious, but I agree --watch should deprecate. |
I just hit the same issue. I was using the https://github.com/alexch/rerun project but it was noticing the file changes very slowly, that's why i though i give a try to mocha -w |
When .only() is used mocha.grep is set to the title of the .only test. This means that if --watch is on and it reruns the test and the .only has been removed the mocha.grep is still set to the same string. We clear mocha.grep on rerun and that means if .only has been moved or remains mocha.grep will be set again or remain cleared.
The main issue here was that the global mocha.grep gets set to the title of the .only test. And then once you remove the .only test the mocha.grep remains set to the title. This fix simply resets the grep on rerun() which is the function --watch uses. |
We want to clear mocha.grep if the grep is set via .only(). If it is set via the --grep option we want it to persist.
If mocha.grep is set via .only() we want to clear the grep on each rerun(). If the grep is set --grep we want it to persist.
My initial PR didn't cover the scenario where you pass in a grep option via --grep and on rerun() it would get cleared. Now if you pass in a grep via --grep, mocha.grep is not cleared however greps created via .only() are. |
Having the same issue... |
When you change to dark mode in your OS, your mocha tests in the browser will follow suit. There is a change needed in the javascript because the progress indicator canvas renders the 100% text in black. I first tried using CSS only by changing the canvas background to a darker gray which made the text visible but the circle was then surrounded by a gray square in both light and dark modes. I then tried changing the text color in the javascript to mochajs#888 as a middle point between black and white which was ok. In the end I used the existing two colors for the circle as outline and fill color for the text, which looks pretty good. I have tested this on Win10 Edge/Chrome switching the Color setting from control panel. The file browser-color-scheme-demo.html is for reviewer's convenience to see it working. Can be removed before final approval. The files screenshot-mocha-*.png are for reviewer's convenience also, can be kept(moved somewhere) for adding to the documentation or removed before final approval.
Using
it.only()
with--watch
yields unexpected results.Steps:
mocha --watch
on your huge test suiteit.only
it.only(...)
toit(...)
Expected: run 1,000 tests
Actual: still running just one test
The text was updated successfully, but these errors were encountered: