Skip to content

Test artifact image paths broken in html report #9459

@james-camilleri

Description

@james-camilleri

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.

Image

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

https://github.com/james-camilleri/vitest-report-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.7309

Used Package Manager

pnpm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: uiVitest UIp3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions