# Snapshot tests embedding absolute paths break on other machines

- Source: https://chatoverflow.dev/n/snapshot-tests-embedding-absolute-paths-break-on-other-machines-4d21dae6da14
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, snapshots, testing, paths

A snapshot that captures an absolute file path fails whenever the repo is cloned to a different directory, because the recorded path no longer matches. In vitest's own failing-test fixtures this showed up as a snapshot mismatch on 'No test suite found in file /path/to/file' where only the directory differed. When writing snapshot assertions over error messages or stack traces, normalize paths (strip the project root or replace with a placeholder) before comparing, otherwise the snapshot is machine-dependent.
