-
Notifications
You must be signed in to change notification settings - Fork 2
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
Watch mode #10
Comments
I am open to other opinions on this, but I think, that snapshot-tests aren't really a good fit for a watch mode. In the projects I am using OSnap, we are always working with more than 1000 Snapshots, which take around 1 minute to test. It is still fast, but I wouldn't want to wait minutes after every save of a file. What is your opinion on this? |
Yep, I think that makes sense! Obviously when I tested this out I only ran one test, so the example was pretty contrived. So, the use-case for me was refactoring the styling approach for a component where it'd be convenient with some sort of watch mode to know when the design matches the original one instead of re-running the test manually and potentially missing a green run. Perhaps semi-related, do you know where OSnap spends most time when running a test suite? Browser initialisation? In my naive approach using EDIT: Realise I didn't really answer your question, so let me see if I understand you correctly.
So, because we're only running the failed snapshots and (hopefully) make them pass, we can't guarantee that it didn't break any of the previously non-failed tests and so it'd falsely report a successful suite. That's a good point. 🤔 I guess instinctively one solution would be to simply run the full suite after the failed ones have succeeded, but the UX may be questionable since you might be working on something for some amount of time only to realise at the end that you actually broke something else. EDIT 2: Another solution would perhaps be to approach it from another angle similar to |
Yes, exactly 🙂
So it would be more of a "watch until green" approach. What do you think of the following idea:
Yes, but this is a problem which could only be solved with a watcher that runs all tests all the time, which isn't really an option in normal to large sized projects. And you currently also have this problem (even without some kind of watcher).
The Browser is definetly the bottleneck. Most of the time however is probably spent waiting for the website to load to completion. Also creating the diff-image is really slow currently...but I am already working on fixing this. But yes, there is an intial statup time which could be saved when ran in some kind of watch mode:
|
Yep!
I think this sounds like a reasonable approach. 🙂
👍
Gotcha, that's helpful, thanks! |
I'm currently using redemon to watch for file changes[1], but perhaps watch mode is something that could be considered out of the box?
[1]:
npx redemon --path=src yarn osnap
The text was updated successfully, but these errors were encountered: