adopt vitest; fix hex bug by Fil · Pull Request #2373 · observablehq/plot
| @@ -56,7 +63,7 @@ for (const [name, plot] of Object.entries(plots)) { | |||
| await fs.writeFile(diffile, actual, "utf8"); | |||
| } | |||
|
|
|||
| assert.ok(equal, `${name} must match snapshot`); | |||
| expect(equal, `${name} must match snapshot`).toBe(true); | |||
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue here is that snapshots have embedded images and that the file snapshots need to discard them (with something like <replaced>) because of inconsistencies between platforms. We can adopt a system where the images are compared separately, but it's not so great when you review changes visually.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can do it with a custom snapshot serializer.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New strategy: extract the images to the side as PNGs, apply the image comparison algo to them, and link them by name instead of the <replaced> string.