← Back to context

Comment by grncdr

3 years ago

Ah neat, I've heard different names for snapshot/golden master type testing before, but generally find the tooling a bit lacking. It seems like https://github.com/approvals/ actually has pretty decent implementations for most languages.

I feel like the Jane Street approach of embedding the snapshots directly in test sources would make a qualitative difference to the ergonomics. The post implies that this requires some emacs integration, but there's no reason it couldn't be done by a test runner process instead. It would also be cool to have an LSP that provide a hover text or go-to-definition for externally stored snapshots.

> usually requiring all kinds of scaffolding and even resources like files, db, or mocked http requests

Yes, anything with timestamps or generated identifiers gets very annoying as you have to manually exclude certain data from the snapshots, negating some of the "easy wins" a snapshot/approval process provides for pure/idempotent code.

A VSCode plugin could inline the expected answer file, or at least link to it. I like a seperate file because what if you want whitespace checkin behaviour to be different?