-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Test artifact image paths broken in html report #9459
Description
Describe the bug
The screenshots under "Test Artifacts" section of the Vitest html report, when running visual regression tests, are broken. All src paths for image artifacts (both reference screenshots and diff images) seem to be incorrect. The generated URL seems to begin with /data and then include the whole absolute file path on the local filesystem, which is not correctly parsed by a browser when previewing the report. This has been tested on Windows and WSL.
As a result, any visual regression test failures are impossible to diagnose, especially if running on a CI environment.
Ideally, the test artifact images should be bundled into the html report directory by default and configured to use relative paths in @vitest/ui, which would allow the report to function locally as well as be uploaded as a single folder for analysis after CI runs.
A similar issue exists here (#9007), but after updating to the latest version and re-attempting the test run, it seems that the broken paths are not limited to test project configuration, and seem to be broken in all scenarios.
Reproduction
This repro uses @vitest/browser-playwright which is not supported by StackBlitz, and thus will have to be run locally.
System Info
System:
OS: Windows 11 10.0.26100
CPU: (24) x64 12th Gen Intel(R) Core(TM) i9-12950HX
Memory: 6.34 GB / 31.67 GB
Binaries:
Node: 25.2.1 - C:\Users\JamesCamilleri\scoop\apps\nodejs\current\node.EXE
npm: 11.6.2 - C:\Users\JamesCamilleri\scoop\apps\nodejs\current\npm.CMD
pnpm: 10.27.0 - C:\Users\JamesCamilleri\scoop\shims\pnpm.EXE
Deno: 2.6.4 - C:\Users\JamesCamilleri\scoop\shims\deno.EXE
Browsers:
Chrome: 144.0.7559.60
Edge: Chromium (140.0.3485.54)
Internet Explorer: 11.0.26100.7309Used Package Manager
pnpm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.