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

Watching doesn't work properly on Linux #1030

Closed
dchambers opened this issue Sep 1, 2016 · 4 comments
Closed

Watching doesn't work properly on Linux #1030

dchambers opened this issue Sep 1, 2016 · 4 comments

Comments

@dchambers
Copy link

On my Linux laptop, --watch only re-runs your tests when you edit code that happens to be in the same directory as one of your tests. Is this maybe because Inotify doesn't support recursive watch handles?

@dchambers
Copy link
Author

dchambers commented Sep 1, 2016

On the flip-side, AVA tests are an order of magnitude faster (~2s instead of ~20s) on my Linux laptop (i5 x 4 @ 2.2Ghz \w 8GB RAM & SSD) than they are on my Mac laptop (i7 x 2 @ 2.2Ghz \w 8GB RAM & SSD) 😄

I'm guessing this is either as result of me using Babel or because Node’s require is dog slow, but this dramatic speed difference between platforms came as a surprise to me, so I thought I'd mention this too.

@novemberborn
Copy link
Member

We're using chokidar, whose README does imply watching should work recursively. Does anybody else have experience with this?

@dchambers
Copy link
Author

So I just now debugged this, and I noticed that chokidar was being asked to observe changes on these paths:

['package.json', '**/*.js', 'src/**/*.test.js']

So I tried changing the middle one to limit it to only watch my src directory like so:

['package.json', 'src/**/*.js', 'src/**/*.test.js']

and it started working! I was able to permanently effect this change by adding this to my ava config:

"source": [
  "src/**/*.js"
],

I've had experience with watching very large directories on Linux before, and depending on how the distro is configured you can easily run out of watch handles if you watch too many directories, so I'm guessing chokidar is swallowing errors about running out of handles so it just silently fails to report on some directories instead.

You need one watch handle per directory, and you can see how many handles you have available on your distro like this (for me it was set to 65536):

cat /proc/sys/fs/inotify/max_user_watches

Hopefully that helps the next guy!

@novemberborn
Copy link
Member

@dchambers interesting! We can definitely do better in reporting these issues, I've just opened #1071 for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants