Snapshot testing captura um "snapshot" de alguma saída (comumente a saída renderizada de um componente UI ou uma estrutura de dados) e compara execuções futuras contra ela — sinalizando quando a saída muda. É útil para detectar mudanças não intencionais, mas tem limitações que precisam ser entendidas.
Como o snapshot testing funciona
1. First run → the test RECORDS the output (e.g. a rendered component) as a SNAPSHOT file
2. Later runs → COMPARE the current output to the saved snapshot:
→ MATCHES → pass; DIFFERS → fail (the output changed)
3. If the change is INTENTIONAL → UPDATE the snapshot (review the diff, then accept)
(, {
tree = ().();
(tree).();
});
