Replies: 3 comments 1 reply
-
This library should work with Vitest, no? |
Beta Was this translation helpful? Give feedback.
-
Agreed 👍. It would be great to support something similar to what Playwright has built in: https://playwright.dev/docs/test-snapshots With Vitest we can take the screenshots but don't have a built in mechanism for comparing and asserting them. And even if we implement our own comparison (e.g. with pixelmatch or phash) there is no way (that I could find, at least) to display results in the Vitest UI. At the moment we're forced to build a custom reporter that produces a separate report that developers need to check separately. It would be awesome if we could pass some metadata along with errors to let Vitest display Vitest already has something similar, in the form of vitest/packages/ui/client/components/views/ViewReport.vue Lines 117 to 123 in 68e6c63 Alternatively (or in addition), Vitest could add support for rendering HTML error messages. That would let apps render before/after/diff directly in the UI. Probably a way of opting out of escaping HTML here: vitest/packages/ui/client/components/views/ViewReport.vue Lines 33 to 61 in 68e6c63 |
Beta Was this translation helpful? Give feedback.
-
I agree it would be pretty cool to do visual regression testing just using vitest built-ins. I’m working on a project with lots of home made components and design that can be technically usable but visually broken (popovers, sticky toolbars, responsive layouts, etc.). |
Beta Was this translation helpful? Give feedback.
-
A third-party jest matcher called
toMatchImageSnapshot
performs image comparison. It's primarily useful when you do visual tests. It would be pretty cool if vitest could support this kind of testing as one of its built-in features.The lack of visual testing prevents me from migrating from jest to vitest. I believe many other developers who perform visual testing will be interested in this feature.
Beta Was this translation helpful? Give feedback.
All reactions