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

[test]: Watching tests reload every time any file is changed #13

Closed
pixelastic opened this issue Jun 20, 2019 · 1 comment
Closed

[test]: Watching tests reload every time any file is changed #13

pixelastic opened this issue Jun 20, 2019 · 1 comment

Comments

@pixelastic
Copy link
Owner

Calling aberlaas test --watch ./deep/directory correctly runs tests relative to ./deep/directory and re-runs them whenever a file is changed in ./deep/directory...

...but it also reloads the tests whenever a file in changes in ./foo/bar as well.

I played with various Jest options, but couldn't really understand why it was acting that way. The error is especially visible when running a monorepo and watching tests in one module, and editing files in another module will reload the files.

A hackish way to fix this would be to detect when specific files are passed aberlaas test and extract the list of dirnames in which those files are set. Then, we manually add any other directory to watchPathIgnorePatterns to manually force jest to ignore directories where there is no files to check.

@pixelastic
Copy link
Owner Author

This issue seems to not be one. It seems that Jest was actually outsmarting me and reloading the tests because I was changing a file that was included in the dependency tree.

For the monorepo issue mentioned, I found a better way to run the test:watch in that context by using something akin to the hack I mentioned above. So closing it.

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

1 participant