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

Watch does work only for test files, does not refresh for project files #2399

Closed
tomitrescak opened this issue Jul 28, 2016 · 4 comments
Closed

Comments

@tomitrescak
Copy link

tomitrescak commented Jul 28, 2016

I have this strange issue, when mocha reloads only when I update a "test" file. When I update a project file (SUT) the mocha keeps the original version somehow cached. I tried different approaches and nothing works. Any ideas?

Here is how I run it:

mocha --colors --watch imports/test/browser.js imports/**/tests/**/*.js* --compilers js:babel-core/register
@boneskull
Copy link
Member

probably because babel gives mocha a transpiled file, and mocha watches the transpiled file instead of the source file. try it with --require babel-register instead of --compilers; if that doesn't help you, you'll need to have some other tool help you do this.

@boneskull
Copy link
Member

at any rate, #1780 is a thing, and I'd rather not build on top of it in its current state, and instead extract the functionality into a separate module.

@boneskull
Copy link
Member

I heard npm-watch is a thing

@tomitrescak
Copy link
Author

@boneskull thanks for your comment. I solved it along those lines. I used the watch-run lib and here is my solution extracted from package.json

scripts: {
      "test": "mocha --colors imports/**/tests/**/*.js* --require babel-register",
      "test-watch": "watch-run -i -p 'imports/**/tests/**/*.js*,imports/ui/*.jsx' npm run test"
}

run it as

npm run test-watch

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

2 participants