-
-
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
Deprecate --watch #1780
Comments
yes please |
Agreed. I'd really like see Mocha v3 broken down into smaller modules with a lean core. |
It'd be nice to see some suggestions on an alternative, then; all of the 👍'ers obviously know of a better replacement, but I, personally, do not. (I suspect the same is true of plenty of users. :P) |
https://github.com/gruntjs/grunt-contrib-watch I definitely still use |
Not everyone use This is also pretty useful with |
"do one thing and do it well" Mocha runs tests well. It doesn't watch files well. There are better solutions. I understand it is handy for some people, but it's out of scope. |
What is the alternative? |
read above |
Would you mind reading my comment too please? |
I did. But whether or not you use a task runner, |
I'm not sure if If you removing this feature, would you mind providing the other clear path to do it? |
gaze is probably going to be your best bet |
if you don't need something node-based, gaze is a wrapper around the excellent fswatch |
many IDEs and text editors also have this functionality built-in |
Okay, in other words, i either need to switch my projects on some task manager or i can still use That is a bad move in my opinion. |
re: I'm not sure why I need to do this for you, but here's a CLI for gaze. |
Yes, that is why i said "fswatch couldn't be added as node dependency", it is like asking people to install debian package to run
That is the same thing as
Usually, when maintainers of some package, remove pre-existing functionality, they provide an explanation of why they do it and provide an alternative way to achieve the goal. Explanation is the necessity, alternative way, is a common courtesy, sign of mutual respect, not a favor. In other words you don't "need" to do anything and i'm sorry i "need" to write this. |
Yes. Though,
When support is dropped the responsible thing would be to explain a viable alternative--and we will! My comment was out of frustration; obviously there are viable alternatives, and I know you know that. I felt I had to "google it" for you. This was not meant to be disrespectful and I apologize if it came across that way. I use We'll provide well-documented alternatives when the time comes, so thank you for reminding me. In fact, it may be worthwhile to add a "pending deprecation" notice when |
It wouldn't be necessary to ‘google it’ for us, except that's precisely what I asked you to do. @markelog was just clarifying my request, I believe. As for why I asked: I'm not curious about what the solutions are (I'm not a beginner. I do, in fact, know how to use a search engine.); I'm asking what Mocha's response to that question will be, when this is deprecated. I'm sorry I didn't word that better. If Personally, I don't think that's a blocking problem re: deprecating this. I'm all for doing so. ¯_(ツ)_/¯ |
@ELLIOTTCABLE @markelog Maybe this. |
Since In addition to the wider support, it solves the one concern I had above, by providing
|
I use https://github.com/testem/testem for this. |
@ELLIOTTCABLE Yes, chokidar is the way to go |
-1 for this. I like every bit of the --watch how easy it is to setup and how it fits within my package.json/scripts section. Please don't kill it!!! |
@padcom Mocha's main responsibility isn't watching files. We frequently get many issues around the watch functionality, because it doesn't work how people think it will, or has bugs in edge cases, or isn't working cross-platform. To that end, it should be removed from "core". The functionality is helpful, but it's better handled by a third-party tool. That said, there are certain use cases that likely won't work "out-of-the-box" with a third-party tool. A separate module which would wrap something like chokidar is in order. mowatch is/was an experimental tool to provide this outside of Mocha's core. It doesn't use chokidar, but it should. |
Moreover, I find chokidar to be annoying (generates npm warnings on every npm install due to npm not supporting multiple platforms). So I would always prefer watcher to be a separate platform-specific tool rather than integrated into a test runner. |
All the proposed alternatives here seem to ignore the main point: Mocha's If you have a very small project with very few dependencies and you're not doing transpilation, then you don't even need a Node tool to watch files and run a shell command. That's already invented and works well: http://entrproject.org. Those of us who have somewhat bigger projects, using Babel transpilation, will need to find an alternative. A real one. That is, one that keeps Mocha running and doesn't have to respawn a Node process with everything that entails. |
+1 on keeping |
I have a slightly different take on that: if the difference between Mocha's CLI and its JS API is preventing wrapper tools from being effective, we should reduce those differences in general so that wrapper tools will work right, including a dedicated watcher wrapper instead of counting watching as among the things that need to be pushed into the library. I have a similar take on the problem of load times: Mocha's JS API needs better support for running more than once anyway, among other issues, and if we got such improvements then a dedicated watcher tool should be able to use the JS API to avoid total reloading. Ultimately, I'd argue that (For context, I don't feel like |
I do agree with @padcom (that argument is super important)
Couldn't agree more with @ScottFreeCode as well. Until we find an good solution allowing to run mocha more than once especially with transpiler, we should keep I am repeating myself but consider this.
It works just fine, however it takes more and more time to execute as the code base grows. Reason? Using transpiler.
Every time file changes mocha requires babel-register. That means eating away time to transpile everything, whereas re-running mocha tests with |
Interesting bit of trivia (or, perhaps, an example of prioritization and things that go slow): in researching another issue, I discovered that |
I've read /bin/_mocha.js and got wondered a little about --watch.
When we execute mocha-cli with --watch at workspace, the watchFiles contains whole files under workspace. So I tried edit _mocha.js manually like this and "Test-Runs-Twice Problem" seemed to be suppressed. for example…
It might be a clue to resolve some problems about --watch. |
I'm going to close this since it's clear that enough people use It really needs an overhaul though. |
* Type "rs\n" to restart tests, fixes #871 Although the `--watch` feature is somewhat controversial (see #1780), is there any reason not to make it a little easier to use in the meantime? This adds nodemon's shortcut (`rs\n`) for manually restarting. * fix lint errors, add unit test * write to mochaProcess.stdin * Trigger travis build * add documentation * restore trailing whitespace * empty commit (to rerun tests)
@boneskull commented on Jan 30
@dasilvacontin commented on Jan 31
Creating a separate issue for this, so we can close the unrelated #871
The text was updated successfully, but these errors were encountered: