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

Add support for the --watch flag #27

Closed
b0o opened this issue Jun 16, 2023 · 0 comments · Fixed by #44
Closed

Add support for the --watch flag #27

b0o opened this issue Jun 16, 2023 · 0 comments · Fixed by #44

Comments

@b0o
Copy link
Contributor

b0o commented Jun 16, 2023

It would be great to be able to auto-run tests on save. Other adapters like neotest-jest and neotest-python support this. The PR that added support for this to neotest-jest looks like it should map pretty cleanly onto this repo as well.

Resources:

marcoSven added a commit to marcoSven/neotest-vitest that referenced this issue Feb 27, 2024
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]>
marilari88 added a commit that referenced this issue Feb 29, 2024
* feat: Add support for watch flag

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 #27

Signed-off-by: marcoSven <[email protected]>

* Update README.md

Co-authored-by: Marco Ilari <[email protected]>

* Update README.md

Co-authored-by: Marco Ilari <[email protected]>

* Add tests

* Fix test

---------

Signed-off-by: marcoSven <[email protected]>
Co-authored-by: Marco Ilari <[email protected]>
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

Successfully merging a pull request may close this issue.

1 participant