-
Notifications
You must be signed in to change notification settings - Fork 166
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
[mini.test] add generic version of screenshot functionality #909
Comments
Thanks for the suggestion! My first instinct is that screenshot tests should be used specifically if there is no way of writing test without them. Like for testing highlihgting, extmarks, command completion, UI, etc. Or if it would bring huge inconvenience (like too much text to put into file), but this is arguable. I do understand that having some "compare to reference" functionality might be useful. Like indeed something along the lines of |
Thanks @echasnovski ! I've been really happy with I don't know if you maintain a list of "plugins using mini.test" anywhere for glory / inspiration but if you do, feel free to add https://github.com/MagicDuck/grug-far.nvim to that list 😄 Also, side note, a bit of functionality that's been sort of tricky to figure out and was really critical in my situation was a |
That's a good idea. I'll have this in mind. Thanks!
Not sure why though. It works as expected for me. |
Probably cause you were using it without a neovim child? child.lua([[vim.wait(...)]]) which is ok, but not always convenient |
|
Would that not be waiting for any change in general though? In my case I was waiting for a specific change (for the buffer virtual text to contain some string). Anyways, it’s working the way I have it which is all that matters atm. Thank you! |
Contributing guidelines
Module(s)
mini.test
Description
essentially, the issue I've run into is that sometimes a buffer contains more lines of text than is visible in the screenshot, but you would like to test them all the same. In such a case it be nice if there was a generic version of
expect.reference_screenshot()
, maybe let's call itexpect.reference_snapshot(obj)
and the snapshot file would contain the output ofvim.inspect(obj)
.This is an example dirty workaround that I have adapted for my tests:
https://github.com/MagicDuck/grug-far.nvim/blob/393fb7379ee4bfcf67d717640763fd629363485f/lua/grug-far/test/screenshot.lua#L45
which results in screenshots like: https://github.com/MagicDuck/grug-far.nvim/blob/main/tests/screenshots/tests-test_search.lua---can-search-for-some-string-002
Not the prettiest cause of the empty attr lines, but it works for now 😄 .
The text was updated successfully, but these errors were encountered: