Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Build Storybook with --test for Loki screenshot runs (#83003)

Fraserdaa0c256a60a
diff --git a/.github/workflows/loki-stress-test-flake-fix.yml b/.github/workflows/loki-stress-test-flake-fix.yml
index f18d5545ef2..8efa184f43e 100644
--- a/.github/workflows/loki-stress-test-flake-fix.yml
+++ b/.github/workflows/loki-stress-test-flake-fix.yml
@@ -150,7 +150,7 @@ jobs:
run: NODE_ENV=development bun run build-pure:cljs
- name: Build Storybook
- run: bun run build-storybook
+ run: bun run build-storybook:test
env:
STORYBOOK_STORIES_FILTER: ${{ needs.detect-changed-stories.outputs.story_files }}
diff --git a/.github/workflows/loki.yml b/.github/workflows/loki.yml
index 089b9257ebb..68b2220cf2c 100644
--- a/.github/workflows/loki.yml
+++ b/.github/workflows/loki.yml
@@ -88,7 +88,7 @@ jobs:
- name: Build Storybook
env:
STORYBOOK_STORY_PATHS_FILE: ${{ steps.loki-selection.outputs.paths-file }}
- run: bun run build-storybook
+ run: bun run build-storybook:test
- name: Run Loki Visual Tests
# Loki drops stories with parameters.loki.skip, and exits non-zero when that leaves the selection empty.
diff --git a/.storybook/main.ts b/.storybook/main.ts
index 2b373ecb66d..2670edb78a1 100644
--- a/.storybook/main.ts
+++ b/.storybook/main.ts
@@ -58,6 +58,11 @@ const config: StorybookConfig = {
name: "@storybook/react-webpack5",
options: {},
},
+ build: {
+ test: {
+ disableTreeShaking: false,
+ },
+ },
typescript: {
reactDocgen: "react-docgen-typescript",
reactDocgenTypescriptOptions: {
diff --git a/package.json b/package.json
index bf19fe9e259..1a3d7b42a29 100644
--- a/package.json
+++ b/package.json
@@ -426,6 +426,7 @@
"build-static-viz:watch-wait": "bun run wait:cljs; bun run build-static-viz:watch",
"build-stats": "bun install && rspack --json > stats.json",
"build-storybook": "NODE_OPTIONS=--max-old-space-size=8192 storybook build",
+ "build-storybook:test": "bun run build-storybook --test",
"build-watch": "bun run concurrently -n 'cljs,js' 'bun run build-watch:cljs' 'bun run build-watch:js'",
"build-watch:cljs": "bun install && shadow-cljs watch app",
"build-watch:js": "bun install && NODE_OPTIONS=--max-old-space-size=8192 rspack serve --watch",
@@ -501,7 +502,7 @@
"test-unit-watch": "bun run test-unit --watch",
"test-unit-watch:cljs": "bun run concurrently -n 'cljs,tests' 'bun run build-watch:cljs' 'bun run test-unit-keep-cljs --watch'",
"test-visual:loki": "NODE_ENV=development loki test --chromeFlags='--headless --disable-gpu' ",
- "test-visual:loki:ci": "bun run build-storybook && bun run test-visual:loki --reactUri file:./storybook-static --verboseRenderer",
+ "test-visual:loki:ci": "bun run build-storybook:test && bun run test-visual:loki --reactUri file:./storybook-static --verboseRenderer",
"test-visual:loki-approve-diff": "ls .loki/difference | xargs -I _ find .loki/current -name _ | xargs -I _ cp _ .loki/reference/",
"test-visual:loki-prune": "ls .loki/reference | grep -v \"$(ls .loki/current)\" | xargs -I {} rm .loki/reference/{}",
"test-visual:loki-report": "node frontend/test/generate-loki-report-json.js && reg-cli --from .loki/report.json --report .loki/report.html",