Las pruebas de instantáneas (snapshot testing) capturan una "instantánea" de alguna salida (habitualmente el resultado renderizado de un componente de UI o una estructura de datos) y comparan las ejecuciones futuras con ella, señalando cuándo cambia la salida. Son útiles para detectar cambios no intencionados, pero tienen limitaciones que conviene comprender.
Cómo funcionan las pruebas de instantáneas
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).();
});
