@lewiswright/storybook-addon-vis
Version:
Storybook Vitest visual testing addon
2 lines • 824 B
JavaScript
import {expect}from'@storybook/test';import {imageSnapshotMatcher,success}from'vitest-plugin-vis/client';import {setAutoSnapshotOptions}from'vitest-plugin-vis';var s,a;globalThis.__vitest_browser__&&(import('@vitest/browser/context').then(t=>{s=t;}),import('vitest/suite').then(t=>{a=t;}));var r=new Proxy({},{get(t,o){return s?.commands?.[o]}}),e=()=>a?.getCurrentTest();function m(t,o){let n=e();return n?imageSnapshotMatcher(r)(n,t,o).then(()=>success):Promise.resolve(success)}expect.extend({toMatchImageSnapshot:m});function i(t){return t.lastIndexOf("!snapshot")<t.lastIndexOf("snapshot")}var h={beforeEach(t){let o=e();setAutoSnapshotOptions({enable:i(t.tags),...t.parameters?.snapshot,tags:t.tags,...o.meta.vis});}};var b=h;export{b as default};//# sourceMappingURL=preview.js.map
//# sourceMappingURL=preview.js.map