vitest-plugin-vis changelog
5.2.2
Patch Changes
- #962
1847b46Thanks @unional! - Point the package readmes and thereview-image-snapshot-failuresskill at the documentation website. Each readme now has install, minimal configuration, an example, a version compatibility table, and links to the matching website pages. The skill links the “Reviewing Failures with Agents” page on the website instead of a source file.
5.2.1
Patch Changes
5.2.0
Minor Changes
-
#920
6c2e58eThanks @unional! - When an image snapshot mismatches, find the changed regions and write a review image.The failure message now lists the changed regions (
Changed:) and points to a review image (Review:). The review image (<name>.review.png, next to the diff) places the baseline, result, and diff crops of each region side by side, so a person or a coding agent can see what changed without opening the full images. The regions are also written to<name>.regions.jsonnext to the diff. The review image is skipped, and the message says why, when the image size changed, there are more than 5 regions, or the regions cover more than half of the image.Set
reviewImage: falseinvis()ortoMatchImageSnapshot()to not write the review image.The Storybook Vis panel does not list the review image as a diff.
Patch Changes
-
#926
013d9b6Thanks @unional! - Ship anllms.txtin each package so coding agents can find the entry points and documentation pages. It points agents to the new “Reviewing Failures with Agents” page, which tells them to open the review image of a failed image snapshot first, and shows what each view costs in tokens.Each package is also an agent plugin for Claude Code, Cursor, Codex and Copilot CLI. It ships the
review-image-snapshot-failuresskill, which tells an agent to read the error message and the review image before it opens a full image. -
#946
65e4177Thanks @dub578! - Decode images intoImageDatawithcreateImageBitmapand close the bitmap after reading the pixels.new Image()+drawImageleft a full-size decode in Chromium’s image decode cache for every compared image, so renderer memory grew with each image snapshot comparison.
5.1.8
Patch Changes
5.1.7
Patch Changes
-
#889
b770cfeThanks @unional! - Fix auto snapshots hanging until the test timeout whensubjectmatches a hidden element.The
subjectselector was resolved withdocument.querySelector(), which returns the first match even when it is hidden. In Storybook, a selector such asbuttonmatched hidden buttons that Storybook adds to the document, so the screenshot waited for that element to become visible until the timeout. Auto snapshots now use the first visible match.If the selector matches only hidden elements, the snapshot now fails right away with a “not visible” error instead of waiting until the timeout. If it matches nothing,
document.bodyis still used. -
#890
affac03Thanks @unional! - Trim leading and trailing whitespace from test and suite names when building the snapshot path (#847).Storybook appends two spaces to the
describetitle it generates for a CSF Next story that usesstory.test(). Those spaces became two dashes in the snapshot folder name, so the snapshots landed under<story>--/.Snapshots of
story.test()stories now land under<story>/. Move or regenerate the existing baselines from<story>--/to<story>/. Snapshot paths of plain stories and regular tests do not change.
5.1.6
Patch Changes
-
#885
b674dfeThanks @unional! - Updatetype-plusto8.0.0-beta.12.type-plus8.0.0-beta.12 no longer exports the distributivePickandOmitfrom its root. The public types now useObjectPlus.PickandObjectPlus.Omit, which behave the same.
5.1.5
Patch Changes
-
#870
5c2970cThanks @unional! - Pintype-plusto8.0.0-beta.10, exactly.Both packages already declared
type-plus: ^8.0.0-beta.10in the last published release (storybook-addon-vis@4.2.7,vitest-plugin-vis@5.1.4), so this is a range tightening, not a version move:type-plus8’stypescript >= 5.6.0peer already reaches consumers today, and this change does not alter what a fresh install resolves — it only forecloses later8.0.0-beta.xprereleases plus8.0.0and8.1.0.The version is pinned rather than caret-ranged.
^8.0.0-beta.10resolves to>=8.0.0-beta.10 <9.0.0-0, which admits every later 8.0.0 prerelease as well as8.0.0and8.1.0— and 8 is a prerelease line where breaking changes land between betas (beta.10 to beta.11 changedEqual’s signature and removedisType.f). An exact version makes each bump a reviewable PR instead of something a lockfile refresh can do silently. Move back to a caret when 8.0.0 is stable.type-plustypes leak into each package’s emitted declarations:storybook-addon-vis’sdist/exports/vitest-plugin.d.mtsimportsOmitfromtype-plus;vitest-plugin-vis’sdist/shared/commands.types.d.mtsanddist/server/testing/stubSuite.d.mtsimportPickandRecursivePartial. None of these symbols changed between 7 and 8, so no source change was needed.
5.1.4
Patch Changes
-
#861
ee4464aThanks @unional! - Depend ontype-plus^8.0.0-beta.10— back on the 8.x line, as a range.The previous release moved both packages to
^7.6.2. That was the wrong fix. These packages belong on the 8.x line; what was actually broken was that the dependency was an exact pin (8.0.0-beta.8), so it could never resolve forward and consumers were stuck on a build with a real CJS packaging defect:8.0.0-beta.8declares"type": "module"but ships acjs/build with no{"type":"commonjs"}marker, sorequire()of these packages failed withReferenceError: exports is not defined in ES module scope.type-plus@8.0.0-beta.10ships thatcjs/package.jsonmarker and fixes it. The dependency is now the range^8.0.0-beta.10rather than a pin, so later 8.x betas and stable 8.x flow in on their own instead of freezing at one build.The root barrel of
8.0.0-beta.10is byte-identical to8.0.0-beta.8’s, so there is no API change between the two. The localMergealias invis_server_context.types.tsstays as-is; it is version-independent.
5.1.3
Patch Changes
-
#859
62026f5Thanks @unional! - Stop theserverproxy from throwing before the vitest browser module loads.server’sgettrap fell back to(ctx?.server as any)[prop]. The optional chain guardsctx, but the property access straight after it does not, so any read ofserver.<prop>before the dynamicimport('vitest/browser')settled — or outside a browser run, where it never settles — threwTypeError: Cannot read properties of undefinedinstead of returningundefined. The fallback is now optional too.
5.1.2
Patch Changes
-
#851
5364614Thanks @unional! - Show snapshot paths in failure messages relative to the project root (./__vis__/...) instead of absolute.Editors and terminals resolve the relative path just as well, and the output no longer leaks the local absolute path when a failure is pasted into a bug report. Paths outside the project root stay absolute. Filesystem operations are unaffected and still resolve to absolute paths.
-
6697a67Thanks @unional! - Raise dependency floors to pull in security fixes.glob,rimraf,pathe,dedent,is-ci, andpixelmatchmove up within their existing major, which resolves the advisories reaching the runtime dependency tree throughbrace-expansionandtmp. No API change. -
#858
6f65e20Thanks @unional! - Depend on the stabletype-plusline instead of an 8.x prerelease.Both packages carried
"type-plus": "8.0.0-beta.8"as an exact pin in their runtimedependencies.type-plus@latestis deliberately7.6.2; the 8.x line is an unfinished major parked in prerelease. The exact pin forced every consumer to install that prerelease, and consumers that also depend on something else pinning a different 8.x beta resolved two copies oftype-plus. The pin now reads^7.6.2.The only type this needed that 7.x does not export from its root is
Merge, soMergeis now declared locally invis_server_context.types.ts. Emitted output is otherwise byte-for-byte identical to the build under8.0.0-beta.8: the sole difference indistis that one alias moving from an import into the file. No API change.
5.1.1
Patch Changes
5.1.0
Minor Changes
-
#723
69cde31Thanks @unional! - AddcreateMissingBaselinefor image matchers so a missing baseline can be written without-u/updateSnapshot: 'all', and supportvis.setup({ createMissingBaseline: true })defaults for auto snapshots (overridable per test). Document Storybook Vitest browser limitations forcreateMissingBaselineand theupdateSnapshotworkaround. -
#723
fc139fdThanks @unional! - Add opt-inshortenLongSnapshotPathstovis(): when enabled, if representative absolute snapshot paths under__baselines__(aftersnapshotRootDirandsnapshotSubpath) would exceed Windows-safe limits (250 characters or a path segment over 255), keep subpath directories and shorten only the final component to{firstToken}-{hash12}{ext}(tersify-style prefix); legacytaskId-key.pngnames are unchanged. FixgetVisOptionto merge__defaultplugin options with the active Vitest project. StorybookvisProjectsmay setshortenLongSnapshotPathsfor the Vis panel (same semantics as Vitestvis()). ExportresolveSnapshotSubpathWithinLimitsfromvitest-plugin-vis/server-utils.vitest-plugin-vis/testingis browser-safe (fixtures only).getVisOptionandstubSuiteare available fromvitest-plugin-vis/testing/nodefor Node/Vitest project tests.
5.0.0
Major Changes
-
#711
b4c34dcThanks @unional! - Remove deprecated setup APIs and align with Vitest 4.- BREAKING:
createVisis no longer re-exported fromvitest-plugin-vis/setup. Import it fromvitest-plugin-vis/setup-apiinstead. - BREAKING: Removed deprecated
vis.presets,vis.beforeAll, andvis.afterEachhelpers from the object returned bycreateVis. Usevis.setup()(andautoSnapshotMatcherwhere you need per-theme snapshots) instead. - BREAKING: Config preset
noneis renamed tocustom. - BREAKING: Removed the
vitest-plugin-vis/presets/enableentry point; use themanualorautopreset, orcustomwith your ownvitest.setup.ts. - BREAKING: Browser helpers now rely on Vitest 4’s
TestRunner.getCurrentTest/getCurrentSuite(viavitestinstead ofvitest/suite). Requires Vitest 4+ in browser projects.
- BREAKING:
4.2.2
Patch Changes
494a8c7Thanks @unional! - Drop an unnecessary Biome suppression from the Jest matcher module augmentation. Update Storybook-related dev dependencies for local development and remove@storybook/addon-mdx-gfmfrom the package Storybook config.
4.2.1
Patch Changes
4.2.0
Minor Changes
-
#577
d0c04d0Thanks @unional! - Deprecatevis.beforeAll.setup(),vis.afterEach.matchImageSnapshot(),vis.afterEach.matchPerTheme()invitest-plugin-vis/setup.There is no known use case for these methods. Reducing the API surface.
-
#672
ab4ca8aThanks @unional! - AddprojectNameto the context ofsnapshotRootDirto allow users to customize the snapshot root directory based on the project name. This in useful when you use multiple instances in a Vitest project.The
projectNameis generated by Vitest (e.g.vpv:pw (chromium)wherevpv:pwis the project name you defined andchromiumis the browser name).export default defineConfig({test: {name: "vpv:pw",browser: {instances: [{ browser: "chromium" }],},},});If you specify the instance name, the
projectNamewill be the instance name.The
projectNamewill beHDin the following example.export default defineConfig({test: {name: "vpv:pw",browser: {instances: [{ browser: "chromium", name: "HD" }],},},});Also added
rootDirto the context ofsnapshotRootDirto make the snapshot root directory more transparent. -
#577
7ceb998Thanks @unional! - DeprecatecreateVisinvitest-plugin-vis/setup. Addedvitest-plugin-vis/setup-api. -
#551
1c54a56Thanks @unional! - Fail test when no baseline image is found. This behavior is closer to the Visual Regression Test from Vitest.The difference is that the baseline image is not created automatically. You need to create it manually by running the test with the
updateSnapshotoption set toall.This prevents you from accidentally committing a new snapshot or passing the tests when you running the tests for the second time.
Closes #516
Since this change can break existing tests (even though correctly), we will release it as a minor version.
Patch Changes
-
#667
ad87b83Thanks @unional! - Fix retrying. Reported by @sinled. -
#551
495d10cThanks @unional! - Publish as unbundle to improve debuggability.
4.1.0
Minor Changes
- #496
ea6b3b2Thanks @unional! - Provide theautoSnapshotMatcherfunction to create a matcher for auto snapshot in Storybook.
4.0.0
Major Changes
Patch Changes
3.5.1
Patch Changes
-
#472
0ebfe75Thanks @unional! - Replace starting “..” with “__” intrimCommonFolderfunction.This allows test project to reference tests in other projects within a monorepo.
3.5.0
Minor Changes
3.4.1
Patch Changes
3.4.0
Minor Changes
30026e2Thanks @unional! - Handle the case where the test config name is an object with a label. Vitest 3.2.0 starts doing this when running in workspace/project mode.
3.3.2
Patch Changes
cb735b9Thanks @unional! - Revert the change of addingcreateVisfromvitest-plugin-vis/setuptovitest-plugin-vis/client-api.createVisimportsvitest, which cannot be imported in the client side.
3.3.1
Patch Changes
5b25658Thanks @unional! - Fixvis().setup({ auto: ... })type to accept sync and async function with no return value.
3.3.0
Minor Changes
-
#314
090e613Thanks @unional! - DeprecatecreateVisinvitest-plugin-vis/setup. It is moved to/client-api. -
#314
150924dThanks @unional! - Deprecate presetnone, replace it withcustom.
Patch Changes
- #314
4fb0a22Thanks @unional! - AllowgetSnapshotRootDirto be called without specifying a snapshot root directory.
3.2.0
Minor Changes
3.1.0
Minor Changes
3.0.1
Patch Changes
9a25501Thanks @unional! - Fixmanualpreset to be the same asenablein v2. Noteenableis deprecated and will be removed in v4.
3.0.0
Major Changes
-
#259
1d322c4Thanks @unional! - RemoveparseImageSnapshotSubjectfrom the public API (breaking change). -
#259
38734c5Thanks @unional! - Remove the ability to customizesnapshotKeywith function. -
#259
14f57c5Thanks @unional! - RemoveshouldTaeSnapshot()from API. The consumer don’t need to know. Tell don’t ask. -
#259
b68f90aThanks @unional! - UpdatecustomizeSnapshotSubpathtosnapshotSubpath. -
#259
29ea8dcThanks @unional! - RenamematchImageSnapshottomatchImageSnapshotAction(breaking). -
#259
4c9bf36Thanks @unional! - Move/clientto/client-apito indicate that it’s an API, not meant to be used directly (breaking). -
#259
899ce35Thanks @unional! - ChangeimageSnapshotMatchertomatchImageSnapshot(breaking change). -
#259
abcedabThanks @unional! - ReplacesubjectDataTestIdwithsubject. -
#259
4f9ce14Thanks @unional! - RemovematchImageSnapshotcommand. -
#259
fb8603dThanks @unional! - Remove extra/commandsexport. -
#259
11e52daThanks @unional! - RenameImageSnapshotIdOptionstoImageSnapshotKeyOptions -
#259
2f57b5bThanks @unional! - Improvevis.presets.theme()andvis.afterEach.matchPerTheme()type params to not depends onSnapshotMeta. -
#259
ccb67afThanks @unional! - RemoveSnapshotMetafrom API. -
#259
31d9e29Thanks @unional! - RemoveisAutosnapshotfrom commands signature. -
#259
d7e7802Thanks @unional! - Remove the first argument from thesetAutoSnapshotOptionsfunction. -
#259
51b4855Thanks @unional! - RemovetoTaskIdfrom public API. -
#259
ea3735fThanks @unional! - Remove server context from/server-api. It can’t be used outside of Vitest. Rename/server-apito/server-utilsas it is not an API.
Minor Changes
-
#259
7ff4a7bThanks @unional! - Changeactionsto taketaskIdinstead oftest. This allows thetaskIdto be built from other means, such as from Storybook runtime. -
#259
6f74919Thanks @unional! - AddloadImageSnapshotResultsAction -
#283
594c9c9Thanks @unional! - RestrictsnapshotKeyto not accept dash-. -
#259
34973caThanks @unional! - Addpage.toMatchImageSnapshot. -
#259
aa957fcThanks @unional! - DeprecateMatchImageSnapshotCommand. -
#259
5539f6dThanks @unional! - Support full page screenshots withplaywright. -
#259
1b1c13aThanks @unional! - Pass options to page screenshot -
#283
577e42bThanks @unional! - ExporttrimCommonFolderunder/server-utils -
#259
766c035Thanks @unional! - Adjust code to work with latestwebdriverio. It now expect file paths relative to the project root to save screenshots. -
#259
3c8eee0Thanks @unional! - Addvis.setup(). Deprecatevis.presets.enable(),vis.presets.manual(),vis.presets.auto(), andvis.presets.theme(). -
#259
6978c83Thanks @unional! - AddhasImageSnapshotActionto contain the business logic.
Patch Changes
2.4.4
Patch Changes
0b83a6e- Sanitize suite ID to prevent invalid paths. (#270) Thanks @jacob-noble for the contribution 🎉
2.4.3
Patch Changes
2.4.2
Patch Changes
2.4.1
Patch Changes
2.4.0
Minor Changes
-
#240
16c7886Thanks @unional! - Fix relative path issue regarding workspace support. -
#240
2c7afe9Thanks @unional! - Support monorepo workspace usage.
2.3.3
Patch Changes
2.3.2
Patch Changes
2.3.1
Patch Changes
2.3.0
Minor Changes
-
#225
15bbbedThanks @unional! - Add type param tovis.presets.theme()andvis.afterEach.matchPerTheme(). -
#225
4692f23Thanks @unional! - AddisAutoSnapshotprop tocustomizeSnapshotId().
2.2.0
Minor Changes
2.1.1
Patch Changes
- #219
bbbc8e8Thanks @unional! - ImprovesetAutoSnapshotOptions()to work inbeforeAllhook without passing in thesuiteobject.
2.1.0
Minor Changes
2.0.1
Patch Changes
-
#209
a68f5c9Thanks @unional! - Avoid settingsetupFilesinvitest.config.tsto undefined, as Vite v5 does not support it.
2.0.0
Major Changes
-
#204
020121fThanks @unional! - Change thecustomizeSnapshotIdto acceptcontextobject.This is a breaking change. Feature-wise, it is the same as before. We will enable better customization by passing
viewportto thecustomizeSnapshotIdfunction in the future. -
#204
76b09ccThanks @unional! - Add support to customizesnapshotRootDirwith a function. Deprecateplatformoption.
1.7.0
Minor Changes
-
#195
972db1bThanks @unional! - AllowsetAutoSnapshotOptionsto specify additional properties. Each theme invis.presets.theme()andvis.afterEach.matchPerTheme()will receive the options.vis.presets.theme({theme1(options) { ... }})
1.6.5
Patch Changes
1.6.4
Patch Changes
1.6.3
Patch Changes
1.6.2
Patch Changes
- #183
49e8fbcThanks @unional! - ExportAutoSnapshotOptionsto fix the inferred type cannot be named error.
1.6.1
Patch Changes
- #182
537cf83Thanks @unional! - Should not take snapshot when the test failed. Ensure the theme is awaited before taking the snapshot.
1.6.0
Minor Changes
1.5.1
Patch Changes
- #166
611e0ccThanks @unional! - Useconfig.rootinstead ofrunner.root.runner.rootis protected in Vitest v3.
1.5.0
Minor Changes
-
#162
995140fThanks @unional! - Support customizingplatformby @joekrump.For example, with
vis({ platform: 'ci' }), Instead of saving the snapshots to<root>/__vis__/{local or process.platform}, the snapshots will be saved to<root>/__vis__/ci.
Patch Changes
-
#156
72959a6Thanks @unional! - Add top leveltypesfield topackage.jsonfor project not using ESM module resolution. -
#160
d2fdcbeThanks @unional! - RemoveexpectToFailfromVisOptions. It should not have that property. -
#161
43fc2ceThanks @unional! - Change default timeout to 30s. The initial timeout of 1s was set by Vitest. It is causing tests to fail withTimeoutError, even when gettingLocatorlikegetByRole.This timeout will be removed in Vitest 3.
The underlying provider (
playwright) does not have a default timeout.Setting to 30s should be a good default for most cases.
It could still be too short for slow CI or when it is running scripts in parallel. That was the case for
storybook-test-runnerbut could be improved in Vitest browser mode.If timeout is still an issue, we can further default it to 60s or even 120s.
-
#158
a020417Thanks @unional! - Add a blank line to separate the theme error messages. -
#160
ee4ef14Thanks @unional! - Fix the global setting not being applied.
1.4.0
Minor Changes
1.3.2
Patch Changes
1.3.1
Patch Changes
1.3.0
Minor Changes
-
#139
17510d3Thanks @unional! - AddexpectToFailsupport. This is useful to test where the visual should be changed beyond the threshold. -
#144
f642dbfThanks @unional! - Changeimport { matchImageSnapshot } from 'vitest-plugin-vis/client'toimport { imageSnapshotMatcher } from 'vitest-plugin-vis/client'.This is a bug in 1.2.0 because
matchImageSnapshotis hard loading@vitest/browser/context, which causes storybook to fail to load.
Patch Changes
-
#144
2d4f1c0Thanks @unional! - Extendsexpectandpagein presets. -
#144
78cc195Thanks @unional! - Augmentexpectandpagein main so that consumer can load the types:{"compilerOptions": {"types": ["vitest-plugin-vis"]}}
1.2.0
Minor Changes
-
#137
e4bef32Thanks @unional! - Assertcontext.testPathonsetupVisSuitecommand.Add
stubBrowserCommandContextto/testing.
Patch Changes
-
#137
e0fec8eThanks @unional! - Remove import ofvitest-browser-reactin the presets. The plugin is not React specific. -
#137
a3e3c89Thanks @unional! - UpdatewriteImageSnapshotsignature. -
#137
eaa3bbeThanks @unional! - ImprovetestPathassertion message.
1.1.0
Minor Changes
-
#133
badf227Thanks @unional! - Perform image comparison on the client side. This is similar tostorybook-addon-vis@0.13.0, but the image taking is still done on the server side.Try to address the issue of the slower image comparison on the server side.
Export
matchImageSnapshotfunction on the client side. MarkparseImageSnapshotSubjectas deprecated as it is not needed anymore.
Patch Changes
1.0.5
Patch Changes
1.0.4
Patch Changes
1.0.3
Patch Changes
-
#125
1068941Thanks @unional! - Try to improve the performance of the plugin by skipping the rescale step and not checking the CRC of the image.This should be safe because the image is generated by the browser, or it is a base64 string (not 100% sure on this), and the CRC is not used for anything.
If not performance improvement is seen, we can revert this change.
1.0.2
Patch Changes
1.0.1
Patch Changes
-
#117
ae98ec4Thanks @unional! - Proxyvitest/suite.This fix the warning message
Module "util" has been externalized for browser compatibility.when it is loaded in the browser.Fixes #101.
1.0.0
Major Changes
-
#102
03893abThanks @unional! - Initial Release.vitest-plugin-visis a visual testing plugin for Vitest, running on Vitest Browser Mode.