Skip to main content

Module diff

Module diff 

Source
Expand description

Unified-diff rendering for assertion failures.

Produces a plain-text diff (no ANSI) so it survives the Rust โ†’ QuickJS โ†’ JS error round trip. Printers add color at output time. The format matches the GNU diff -u shape โ€” - for expected lines (what we asked for), + for received (what the test got), for context.

Functionsยง

json_diff
Render expected vs received as pretty JSON + a unified diff. Suitable for toEqual / toMatchObject / toContainEqual where the full structural shape matters.
pretty_json
Render a serde_json::Value as multi-line pretty JSON with asymmetric matchers rendered as <Description> placeholders so the diff highlights the matcher rather than its tagged wire shape.
unified_diff
Unified diff between two pretty-printed strings. Lines are prefixed with - / + / ; empty when the two inputs are byte-identical.