* Remove babel Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Remove duplicated patch-package dep Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Switch to @fetch-mock/vitest Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update tests to import & call vitest functions Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update test-utils imports Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update unit test snapshots Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Switch from jest->vitest for unit tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update visual test screenshots Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Switch from test-runner->vitest for visual tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update README Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update CI for shared-components unit & visual tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update yarn.lock Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update README Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix storybook trying to import vitest Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix css modules leaking between storybook tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Tweak screenshot update script to accept args Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
/*
|
|
Copyright 2026 Element Creations Ltd.
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
Please see LICENSE files in the repository root for full details.
|
|
*/
|
|
|
|
import * as a11yAddonAnnotations from "@storybook/addon-a11y/preview";
|
|
import { setProjectAnnotations } from "@storybook/react-vite";
|
|
import { vis, visAnnotations } from "storybook-addon-vis/vitest-setup";
|
|
|
|
import * as projectAnnotations from "./preview.tsx";
|
|
|
|
// This is an important step to apply the right configuration when testing your stories.
|
|
// More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
|
|
setProjectAnnotations([a11yAddonAnnotations, projectAnnotations, visAnnotations]);
|
|
|
|
vis.setup({
|
|
async auto() {
|
|
const style = document.createElement("style");
|
|
style.setAttribute("type", "text/css");
|
|
style.appendChild(
|
|
document.createTextNode(`
|
|
/* Inhibit all animations for the screenshot to be more stable */
|
|
*, *::before, *::after {
|
|
animation: none !important;
|
|
}
|
|
/* Hide all storybook elements */
|
|
.sb-wrapper {
|
|
visibility: hidden !important;
|
|
}
|
|
`),
|
|
);
|
|
document.head.appendChild(style);
|
|
},
|
|
});
|