Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
a04f8a2
refactor(vitest-plugin-vis): update import and usage in example config
unional Jan 29, 2026
a5dc91a
chore(config): update vscode settings, remove tailwindcss formatter a…
unional Jan 29, 2026
dfa00f4
chore(deps): add @storybook/addon-mdx-gfm
unional Jan 29, 2026
cb47a47
docs(vitest-plugin-vis): correct deprecation notice in changelog
unional Jan 29, 2026
2df01c9
chore(config): add regex ignore rule for cSpell in vscode settings
unional Jan 29, 2026
7f8b09b
docs(vitest-plugin-vis): update overview documentation to reflect Vit…
unional Jan 29, 2026
8bb8f97
chore(.storybook): update story sort order in preview.ts
unional Jan 29, 2026
16653fe
refactor(vitest-plugin-vis): update config types and deprecation notices
unional Jan 29, 2026
6454551
docs(vitest-plugin-vis): improve overview documentation with clearer …
unional Jan 29, 2026
402ad48
docs(vitest-plugin-vis): add detailed configuration overview for snap…
unional Jan 29, 2026
b3532ab
refactor(vitest-plugin-vis): rename and reorganize config.vis.mdx doc…
unional Jan 29, 2026
834c9e7
docs(vitest-plugin-vis): update readme to reflect correct execution e…
unional Jan 29, 2026
1bed83b
feat(vitest-plugin-vis): deprecate createVis in setup, introduce setu…
unional Jan 29, 2026
5ef44c7
fix(vitest-plugin-vis): update import to use setup-api module
unional Jan 29, 2026
33eaeb7
feat(vitest-plugin-vis): deprecate unused setup methods
unional Jan 29, 2026
372485e
chore(.storybook): configure Storybook docs settings
unional Jan 29, 2026
4f24637
docs(vitest-plugin-vis/setup): add overview documentation for client-…
unional Jan 29, 2026
fbff6b4
docs(vitest-plugin-vis/setup): add detailed documentation for vis set…
unional Jan 29, 2026
043f6d2
docs(vitest-plugin-vis/config): update vis configuration documentatio…
unional Jan 29, 2026
aa8f2a0
docs(vitest-plugin-vis/setup): move create_vis
unional Jan 29, 2026
a921031
docs(vitest-plugin-vis/setup): remove setup.vis.mdx documentation
unional Jan 29, 2026
696d9d8
docs(vitest-plugin-vis/config): move documentation for trimCommonFold…
unional Jan 29, 2026
ae11891
docs(vitest-plugin-vis/config): update overview documentation with co…
unional Jan 29, 2026
dfd1add
docs(vitest-plugin-vis/config): simplify title in trimCommonFolder do…
unional Jan 29, 2026
1aed20e
chore(vitest-plugin-vis): add import alias for package root
unional Jan 29, 2026
294aa57
chore(vitest-plugin-vis): add import alias for client-api
unional Jan 29, 2026
6713c01
feat(vitest-plugin-vis): move auto snapshot options API
unional Jan 29, 2026
001fa87
chore: update biome schema reference to local node module
unional Jan 29, 2026
f80ad8d
chore(vitest-plugin-vis): update vitest suite proxy import path
unional Jan 29, 2026
fdb3a4d
test(ubuntu-latest/22): update snapshot
unional Jan 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/fruity-onions-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"vitest-plugin-vis": minor
---

Deprecate `vis.beforeAll.setup()`, `vis.afterEach.matchImageSnapshot()`, `vis.afterEach.matchPerTheme()` in `vitest-plugin-vis/setup`.

There is no known use case for these methods.
Reducing the API surface.
6 changes: 6 additions & 0 deletions .changeset/tricky-eyes-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"vitest-plugin-vis": minor
---

Deprecate `createVis` in `vitest-plugin-vis/setup`.
Added `vitest-plugin-vis/setup-api`.
15 changes: 8 additions & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true
},
"[tailwindcss]": {
"editor.defaultFormatter": "MishaLestev.tailwind-css-language-mode-formatter",
"editor.formatOnSave": true
},
"[javascriptreact]": {
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
Expand All @@ -33,6 +29,10 @@
},
"editor.suggest.insertMode": "replace"
},
"[mdx]": {
"editor.defaultFormatter": "yzhang.markdown-all-in-one",
"editor.formatOnSave": true
},
"[typescript]": {
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
Expand All @@ -47,6 +47,7 @@
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true
},
"cSpell.ignoreRegExpList": ["@[A-Za-z0-9.]+$"],
"cSpell.words": [
"bezkrovny",
"biomejs",
Expand Down Expand Up @@ -95,15 +96,15 @@
"vitest.config.node.ts": "vitest",
"vitest.config.playwright.ts": "vitest",
"vitest.config.webdriverio.ts": "vitest",
"vitest.setup.ts": "vitest",
"vitest.setup.playwright.ts": "vitest",
"vitest.setup.ts": "vitest",
"vitest.setup.webdriverio.ts": "vitest"
},
"typescript.updateImportsOnFileMove.enabled": "always",
"typescript.updateImportsOnPaste.enabled": true,
"typescript.preferences.importModuleSpecifierEnding": "js",
"typescript.preferences.includePackageJsonAutoImports": "on",
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.tsserver.web.projectWideIntellisense.enabled": true,
"typescript.updateImportsOnFileMove.enabled": "always",
"typescript.updateImportsOnPaste.enabled": true,
"yaml.format.singleQuote": true
}
2 changes: 1 addition & 1 deletion biome.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/2.3.6/schema.json",
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"extends": ["@repobuddy/biome/recommended"],
"vcs": {
"enabled": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/storybook-addon-vis/src/vitest-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import './client/storybook/expect_extend.ts'
import './shared/global_matcher_augment.ts'

import { createVis } from 'vitest-plugin-vis/setup'
import { createVis } from 'vitest-plugin-vis/setup-api'
import { commands } from './client/vitest_proxy.ts'

export const vis = createVis<{ tags: string[] }>(commands)
Expand Down
4 changes: 4 additions & 0 deletions packages/vitest-plugin-vis/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ const config = {
addons: [
getAbsolutePath('@storybook/addon-docs'),
getAbsolutePath('@storybook/addon-vitest'),
getAbsolutePath('@storybook/addon-mdx-gfm'),
getAbsolutePath('storybook-addon-tag-badges'),
getAbsolutePath('@storybook-community/storybook-dark-mode'),
],
docs: {
defaultName: 'Overview',
},
framework: {
name: getAbsolutePath('@storybook/react-vite'),
options: {},
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest-plugin-vis/.storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const preview: Preview = {
},
options: {
storySort: {
order: ['Overview', 'Changelog'],
order: ['Overview', 'config', 'setup', '*'],
},
},
...defineDarkModeParam({
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest-plugin-vis/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@

### Minor Changes

- [`0360253`](https://github.com/repobuddy/storybook-addon-vis/commit/03602536b5ebf67b7d898f95d6511e5b05da96a9) Thanks [@unional](https://github.com/unional)! - Depreacate `toTaskId`.
- [`0360253`](https://github.com/repobuddy/storybook-addon-vis/commit/03602536b5ebf67b7d898f95d6511e5b05da96a9) Thanks [@unional](https://github.com/unional)! - Deprecate `toTaskId`.

- [#133](https://github.com/repobuddy/storybook-addon-vis/pull/133) [`badf227`](https://github.com/repobuddy/storybook-addon-vis/commit/badf2273828ad883763e1e328b4e180c07b4960a) Thanks [@unional](https://github.com/unional)! - Perform image comparison on the client side.
This is similar to `storybook-addon-vis@0.13.0`, but the image taking is still done on the server side.
Expand Down
7 changes: 7 additions & 0 deletions packages/vitest-plugin-vis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
},
"type": "module",
"imports": {
"#vitest-plugin-vis": "./src/index.ts",
"#vitest-plugin-vis/client-api": "./src/client-api.ts",
"#vitest-plugin-vis/config": "./src/config.ts",
"#vitest-plugin-vis/setup": "./src/setup.ts"
},
Expand Down Expand Up @@ -56,6 +58,10 @@
"types": "./dist/setup.d.mts",
"default": "./dist/setup.mjs"
},
"./setup-api": {
"types": "./dist/setup-api.d.mts",
"default": "./dist/setup-api.mjs"
},
"./testing": {
"types": "./dist/testing.d.mts",
"default": "./dist/testing.mjs"
Expand Down Expand Up @@ -110,6 +116,7 @@
"@repobuddy/typescript": "^2.1.0",
"@storybook-community/storybook-dark-mode": "^7.1.0",
"@storybook/addon-docs": "^10.1.10",
"@storybook/addon-mdx-gfm": "^8.6.14",
"@storybook/addon-vitest": "^10.1.10",
"@storybook/react-vite": "^10.1.10",
"@tailwindcss/vite": "^4.1.14",
Expand Down
4 changes: 2 additions & 2 deletions packages/vitest-plugin-vis/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,12 @@ you can use `snapshotSubpath` to customize the snapshot sub-path to avoid confli

```ts
// vitest.config.ts
import { storybookVis } from 'storybook-addon-vis/vitest-plugin'
import { vis } from 'vitest-plugin-vis/config'
import { defineConfig } from 'vitest/config'

export default defineConfig({
plugins: [
storybookVis({
vis({
// keep the folder structure
snapshotSubpath: (subpath) => subpath
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getCurrentSuite, getCurrentTest } from '../external/vitest/vitest_suite_proxy.ts'
import { getCurrentSuite, getCurrentTest } from '../client/external/vitest/vitest_suite_proxy.ts'

export const ctx = {
getCurrentTest,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { NAME } from '../client-api.ts'
import type { MetaTask } from './auto_snapshot_options.ts'
import type { SnapshotMeta } from './snapshot_meta.ts'

export function extractAutoSnapshotOptions<M extends SnapshotMeta<any> = SnapshotMeta<any>>(
task: MetaTask,
): M | undefined {
if (!task) return

const list: any[] = []
let current = task
while (current?.suite) {
list.unshift(current.suite.meta)
current = current.suite
}
list.unshift(task.file?.meta)
list.push(task.meta)
return list.reduce(
(acc, cur) => {
const meta = cur?.[NAME]
// biome-ignore lint/performance/noAccumulatingSpread: I think this is needed
return meta ? Object.assign({}, acc, meta) : acc
},
{ enable: false },
)
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { setAutoSnapshotOptions } from '#vitest-plugin-vis'
import { beforeAll, it } from 'vitest'
import { setAutoSnapshotOptions } from '../../client-api.ts'
import { extractAutoSnapshotOptions } from './auto_snapshot_options.ts'
import { extractAutoSnapshotOptions } from './_extract_auto_snapshot_options.ts'

beforeAll(() => setAutoSnapshotOptions(false))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Meta } from "@storybook/addon-docs/blocks";

<Meta title="vitest-plugin-vis/setAutoSnapshotOptions" />
<Meta title="auto snapshots/setAutoSnapshotOptions" />

# setAutoSnapshotOptions

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { setAutoSnapshotOptions } from '#vitest-plugin-vis'
import { beforeAll, beforeEach, describe, it } from 'vitest'
import { setAutoSnapshotOptions } from '../../client-api.ts'
import { NAME } from '../../shared/constants.ts'
import { extractAutoSnapshotOptions } from './auto_snapshot_options.ts'
import { NAME } from '../shared/constants.ts'
import { extractAutoSnapshotOptions } from './_extract_auto_snapshot_options.ts'

beforeAll(() => {
// this set the `file` meta
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assertSnapshotKeyWithoutDash } from '../../shared/asserts.ts'
import { NAME } from '../../shared/constants.ts'
import type { ComparisonMethod } from '../../shared/types.ts'
import { assertSnapshotKeyWithoutDash } from '../shared/asserts.ts'
import { NAME } from '../shared/constants.ts'
import type { ComparisonMethod } from '../shared/types.ts'
import { ctx } from './_ctx.ts'
import type { SnapshotMeta } from './snapshot_meta.ts'

Expand Down Expand Up @@ -62,25 +62,3 @@ function getTask(): MetaTask | undefined {
function parseMeta<M extends ComparisonMethod>(meta: boolean | SnapshotMeta<M>): SnapshotMeta<M> {
return typeof meta === 'boolean' ? ({ enable: meta } as any) : { enable: true, ...meta }
}

export function extractAutoSnapshotOptions<M extends SnapshotMeta<any> = SnapshotMeta<any>>(
task: MetaTask,
): M | undefined {
if (!task) return

const list: any[] = []
let current = task
while (current?.suite) {
list.unshift(current.suite.meta)
current = current.suite
}
list.unshift(task.file?.meta)
list.push(task.meta)
return list.reduce(
(acc, cur) => {
const meta = cur?.[NAME]
return meta ? Object.assign({}, acc, meta) : acc
},
{ enable: false },
)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ComparisonMethod, ImageSnapshotSubjectOptions, ToMatchImageSnapshotOptions } from '../../shared/types.ts'
import type { ComparisonMethod, ImageSnapshotSubjectOptions, ToMatchImageSnapshotOptions } from '../shared/types.ts'

export type SnapshotMeta<M extends ComparisonMethod> = ToMatchImageSnapshotOptions<M> &
ImageSnapshotSubjectOptions & {
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest-plugin-vis/src/client-api.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import './server/commands/augment.ts'

export * from './auto_snapshots/auto_snapshot_options.ts'
export * from './client/actions/has_image_snapshot_action.ts'
export * from './client/actions/load_image_snapshot_results_action.ts'
export * from './client/actions/match_image_snapshot_action.ts'
export * from './client/actions/match_page_image_snapshot_action.ts'
export * from './client/expect/expectation_result.ts'
export type * from './client/expect/to_match_image_snapshot.types.ts'
export * from './client/suite/auto_snapshot_matcher.ts'
export { setAutoSnapshotOptions, type MetaTask } from './client/task/auto_snapshot_options.ts'
export * from './client/task/task_id.ts'
export * from './shared/constants.ts'
export type * from './shared/types.ts'
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { setAutoSnapshotOptions } from '#vitest-plugin-vis'
import { loadImageSnapshotResultsAction, toTaskId } from '#vitest-plugin-vis/client-api'
import { expect, it } from 'vitest'
import { render } from 'vitest-browser-react'
import { commands, page } from 'vitest/browser'
import { getCurrentTest } from '../external/vitest/vitest_suite_proxy.ts'
import { setAutoSnapshotOptions } from '../task/auto_snapshot_options.ts'
import { toTaskId } from '../task/task_id.ts'
import { loadImageSnapshotResultsAction } from './load_image_snapshot_results_action.ts'

it('returns empty array when no image snapshots', async () => {
const results = await loadImageSnapshotResultsAction(commands, toTaskId(getCurrentTest()))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { setAutoSnapshotOptions } from '#vitest-plugin-vis'
import { afterEach, beforeEach, describe, it } from 'vitest'
import { render } from 'vitest-browser-react'
import { page, server } from 'vitest/browser'
import { getCurrentTest } from 'vitest/suite'
import { UNI_PNG_BASE64 } from '../../testing/constants.ts'
import { setAutoSnapshotOptions } from '../task/auto_snapshot_options.ts'
import { ctx } from './_ctx.ts'

beforeEach(() => setAutoSnapshotOptions({ enable: false }))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { SnapshotMeta } from '../../auto_snapshots/snapshot_meta.ts'
import { hasRenderContent } from '../external/browser/has_render_content.ts'
import type { SnapshotMeta } from '../task/snapshot_meta.ts'

export function shouldTakeSnapshot(meta: SnapshotMeta<any> | undefined) {
return hasRenderContent() && meta?.enable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import dedent from 'dedent'
import { extractAutoSnapshotOptions } from '../../auto_snapshots/_extract_auto_snapshot_options.ts'
import type { SnapshotMeta } from '../../auto_snapshots/snapshot_meta.ts'
import type { SetupVisSuiteCommand } from '../../shared/commands.types.ts'
import type { ComparisonMethod } from '../../shared/types.ts'
import { shouldTakeSnapshot } from '../snapshot/should_take_snapshot.ts'
import { extractAutoSnapshotOptions } from '../task/auto_snapshot_options.ts'
import type { SnapshotMeta } from '../task/snapshot_meta.ts'
import { toTaskId } from '../task/task_id.ts'
import { ctx } from './_ctx.ts'

Expand Down
76 changes: 0 additions & 76 deletions packages/vitest-plugin-vis/src/config.vis.mdx

This file was deleted.

Loading