Skip to content
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

Add a key-press to re-run the specs under --watch #871

Closed
ELLIOTTCABLE opened this issue May 28, 2013 · 9 comments
Closed

Add a key-press to re-run the specs under --watch #871

ELLIOTTCABLE opened this issue May 28, 2013 · 9 comments

Comments

@ELLIOTTCABLE
Copy link
Contributor

I love --watch. It's great. But there's a few situations where I need to re-run the tests, and it doesn't catch them (i.e. changing an implementation file, as opposed to a test-file, see #870); it'd be nice if hitting the spacebar with the Terminal focused (or something along those lines) forced a re-run of the tests.

Along the same lines, it might be nice to be able to configure a minimum timeout to re-run them anyway, so that the window is always up-to-date, even if it misses a change. (Obviously more tenable for small projects than big ones … but isn't that already the case with --watch?)

@tj
Copy link
Contributor

tj commented Jun 13, 2013

yeah a timeout sounds reasonable to me!

@kevindente
Copy link

+1 for this.

@al-the-x
Copy link

How hard would adding a system event listener be? Maybe SIGINT to the process to rerun, twice to quit (a la the node REPL)...?

@ELLIOTTCABLE
Copy link
Contributor Author

(@al-the-x why SIGINT? There's plenty of other signals that don't stomp on a user's ⌃C expectations. man signal. Personally, I think SIGINFO, ⌃T, is appropriate)

@al-the-x
Copy link

I agree that a different signal would be more appropriate: SIGINFO, SIGIO, etc. I don't know to many folks that know how to send anything other than SIGINT via the keyboard... I usually wow them with ^D and ^Z, and I teach the stuff to professionals.

Maybe ^C shows some info on which signals are supported and a hint to the control character... Wouldn't recommend trying to parse their stty -a or anything, but a reminder might help.

@ELLIOTTCABLE
Copy link
Contributor Author

@al-the-x to most users, ⌃C isn't ‘send a signal to the program’, it's ‘get me out of this program to the place where I type other programs' names.’ And that's assuming they know that those two things are different. Hence my original suggestion of swallowing the space-bar or something; that's a more intuitive interface for the vast majority of users, than attempting to explain UNIX signals to them (or worse, stomping on possibly pre-existing expectations of being returned to the terminal, to do so)

@TimothyGu
Copy link
Contributor

I have to agree with @ELLIOTTCABLE here. SIGINT means "interrupt," i.e. "mocha, f*ing kill yourself!"

SIGUSR1 might be fit for this job, but it's impossible to type that on a keyboard.

SIGINFO means:

A synonym for SIGPWR

(man 7 signal)

Which is:

Power failure (System V)

(man 7 signal)

nodemon's approach might be best, i.e. typing rs\n.

@boneskull
Copy link
Member

IMO "watch" should be killed. There are other tools which do this sort of thing much better.

@dasilvacontin
Copy link
Contributor

+1 to kill watch. I don't see the point of replicating the functionality of a watcher inside the project, when any watcher tool will do the job.

craigtaub pushed a commit that referenced this issue Dec 13, 2019
* 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants