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
watchForFileChanges during cypress run
and rerun tests
#3665
Comments
If you want to watch for file changes, you should use |
is there a reason |
@towc It's not on our roadmap to include file watching during |
I would also love the ability to run tests in watch mode on a terminal. While I appreciate that seeing the tests running in a browser is a key feature in general, for some of us the main value of an automated test suite is precisely to reduce the human/manual factor and not needing to inspect your browser while developing |
For those who come to this and want to be able to re-run Cypress on file change, you can use
In your "scripts": {
"cypress": "nodemon -e js,jsx,ts,tsx,css,scss --exec cypress run"
} Change the extensions after |
Unfortunately nodemon is only a workaround with the side effect of every run terribly slow. I wish cypress had similar watch-ability and test rerun-ability as Jest runner. |
cypress run
and rerun tests
Why use nodemon as a workaround when you can just use cypress open? the workaround is already there. although it seems like this behavior is intended anyway. cypress run is a perfect solution for me since I don't want to change anyone else's settings, and I don't want tests to rerun. |
Because the requirement is to run in headless mode re-running the tests on file changes - the same way Jest does it. Today I am exploring Cypress as a first-time user to understand if it is useable for our use cases and whether it has good DX (developer experience). Documentation did not mention any way to watch for file changes and re-run the tests automatically in CLI environment (no X Windows System), hence I googled and ended up on this thread. I see no reason to enforce or depend on Cypress Open UI app to watch for test file changes if the same can be done via CLI tools. If this type of feature is not on your roadmap yet - that's fine, but I am sure there are many people who would be happy to have this capability. |
I would love to have this feature as well; some times I just wish to test without having a browser running (like some API or random Unit Tests), would definitely encourage TDD. For now, emulating using $ while true; do watch -g ls -l cypress/integration > /dev/null && npx cypress run; sleep 3; done; |
Please look - #22410 |
My cypress code is keep looping --> start of the tests I created test data which is saved in the fixtures folder. |
|
so for now it's still not possible to watch files changes from the terminal, is it right? I mean, we don't have this option as part of cypresse imlementation. |
https://github.com/cypress-io/cypress-watch-preprocessor this used to work? |
To add another reason to do this, Cypress open's ability to take screenshots is broken: No two runs in Cypress open give the same screenshots for me, while Cypress run does seem to be repeatable (as far as I've seen). Also, I want to make changes that should not change the visuals. I don't want to look at them unless something has gone wrong; the UI is very distracting at times. |
Current behavior:
The command
cypress run
is not watching for file changes. Even if I set it on the cypress.json. If I run only successful tests, I got the following output on terminal:Then, it exits
If any of the tests fails, I got the following:
Desired behavior:
It should be waiting for file changes and re run all tests if there is any change
Steps to reproduce: (app code and test code)
Just run
cypress run
Versions
Cypress version: 3.1.5
The text was updated successfully, but these errors were encountered: