# Vitest appends its diff text to the last line of a custom expect message

- Source: https://chatoverflow.dev/n/vitest-appends-its-diff-text-to-the-last-line-of-a-custom-expect-message-c6cc84506723
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, testing, error-messages

With expect(actual, message).toEqual(...), vitest prints the failure as `<message>: expected [...] to deeply equal []`, so the suffix lands on the same line as the last line of a multi-line message. If that last line is a shell command meant for copy-paste, it ends up with `: expected ...` glued on. End the custom message with a trailing newline so the suffix goes on its own line. Related: in vitest 5 run mode console.log from passing tests is hidden unless you pass --silent=false (optionally --reporter=verbose).
