Files
clan-core/pkgs/clan-app/ui/.storybook/main.ts
Brian McGee 807b9fd61f feat(ui): enable storybook snapshot tests
- adds a process-compose namespace for running `storybook` and `luakit` together to replicate the `webkit`-based rendering that happens inside of `webview`
- adds some helper scripts for running storybook tests and updating snapshots, with documentation in the README.
- adds a `clan-app-ui-storybook` package which builds and tests the storybook, checking for rendering changes

Currently, we’re only doing markup-based snapshot tests. We’re also using headless chromium for the tests by default as I couldn't get webkit to work in the nix build.

As we’re only markup-based for the time being, this should be ok. But eventually I'd like to get it working with webkit.
2025-05-30 11:06:14 +01:00

35 lines
914 B
TypeScript

import { createRequire } from "module";
import { dirname, join } from "path";
import { mergeConfig } from "vite";
import type { StorybookConfig } from "@kachurun/storybook-solid-vite";
const require = createRequire(import.meta.url);
const getAbsolutePath = (pkg: string) =>
dirname(require.resolve(join(pkg, "package.json")));
const config: StorybookConfig = {
stories: ["../src/components/**/*.mdx", "../src/components/**/*.stories.tsx"],
addons: [
getAbsolutePath("@storybook/addon-links"),
getAbsolutePath("@storybook/addon-essentials"),
getAbsolutePath("@storybook/addon-interactions"),
],
framework: {
name: "@kachurun/storybook-solid-vite",
options: {},
},
async viteFinal(config) {
return mergeConfig(config, {
define: { "process.env": {} },
});
},
docs: {
autodocs: "tag",
},
core: {
disableTelemetry: true,
},
};
export default config;