mocha: Cannot combine --delay and --watch and --require hook

Title says all: this command does not restart my tests when changing them:

mocha --recursive --watch --require setup.js --delay

With gist!

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 2
  • Comments: 23 (7 by maintainers)

Commits related to this issue

Most upvoted comments

@Download I have no babel experience per se, but your repo problem would seem a little more basic than that. You never told Mocha to watch your JSX file. Try adding --watch-extensions jsx; Mocha only watches ‘js’ by default.

When run this way, Mocha will show you what is being watched…

$ DEBUG="mocha:watch" node_modules/mocha/bin/mocha --require babel-register --watch "test/**/*.spec.jsx"

Well I be darned!! This actually works! W00t w00t!!!

Wow I cannot believe I spend so many hours trying to get this to work and somehow completely missed this watch-extensions thing. Man this is so great! I have been avoiding mocha + babel in my smaller projects even though I like both because the pain of watch not working was killing all the joy. With this fix I can finally use babel+mocha everywhere!

@plroebuck Thanks man!!!