Closed godlygeek closed 1 month ago
Hey, I forgot to update this issue but this is now possible as of 1.0.0
!
1.0.0
also produces separate SVG files per snapshot test (meaning you'll have to regenerate them), but this means you can easily view snapshots and even view them directly inside GitHub PRs!
Currently
snap_compare
requires the path to a file that it will import and run, but that's got poor ergonomics for tests that want to dependency inject mocked data into the app, as well as for Textual apps that aren't typically run directly by the user as a script.In my case, I'd like to use this library for testing the Memray TUI, which I'm currently working on moving to Textual from Rich. That TUI is run as a subcommand of the
memray
CLI (e.g.memray live ...
ormemray run --live ...
), so there is no file with a globalApp
instance to be run. I can create one, just for testing, but even then I have no easy way to pass the mock data that I want the tests to work with from my test module into that new file. It seems like allowing anApp
instance to be passed tosnap_compare
instead of a path to a file would require less work from me, and make it easier for the test to supply mock data to the app.