-
Notifications
You must be signed in to change notification settings - Fork 33
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
feat: Add support for watch flag #44
feat: Add support for watch flag #44
Conversation
This commit introduces a feature to support the watch mode in neotest. In the previous implementation, the user had the ability to run tests but there was no provision to watch the files and run the tests when changes occur. This feature is particularly helpful while doing test-driven development where code changes frequently. 1. Added key mappings examples in README.md to trigger watch mode. 2. Refactored the build_spec function in init.lua to support watch mode. It now includes command flag "--watch=false" in the command list instead of --run. 3. Added a new function stream in util.lua which continuously reads file data and triggers a callback function for new data. This is used to watch the test files and run tests on file change. closes marilari88#27 Signed-off-by: marcoSven <[email protected]>
@marcoSven Big thanks for your contribution! I left a couple of comments for you. One concern though: I noticed when testing the PR that the vitest process in watch mode sticks around until Neovim shuts down or Neotest stop is called. This could lead to a bunch of unwanted background processes if we're running lots of tests in watch mode. How do you handle it? |
Co-authored-by: Marco Ilari <[email protected]>
Co-authored-by: Marco Ilari <[email protected]>
I think this is the same with the Jest adapter. |
@marcoSven thanks! |
This commit introduces a feature to support the watch mode in neotest. In the previous implementation, the user had the ability to run tests but there was no provision to watch the files and run the tests when changes occur. This feature is particularly helpful while doing test-driven development where code changes frequently.
Screen.Recording.2024-02-27.at.18.25.37.mov
closes #27