1- /// <reference types="vitest/config" />
21import { existsSync , readdirSync } from "node:fs" ;
32// Build one entry per primitive/component/hook so each is published as its own
43// subpath. The three component tiers each get a group: `base` (Base UI extensions),
@@ -14,12 +13,21 @@ import path from "node:path";
1413import { fileURLToPath } from "node:url" ;
1514
1615import { storybookTest } from "@storybook/addon-vitest/vitest-plugin" ;
17- import { playwright } from "@vitest/browser-playwright" ;
1816import { defineConfig } from "vite-plus" ;
17+ import { playwright } from "vite-plus/test/browser-playwright" ;
1918import { configDefaults } from "vite-plus/test/config" ;
2019
2120const dirname =
2221 typeof __dirname !== "undefined" ? __dirname : path . dirname ( fileURLToPath ( import . meta. url ) ) ;
22+ const agentIgnorePatterns = [ "**/.claude/**" , "**/.agents/**" ] ;
23+ const taskInput = [
24+ { auto : true } ,
25+ "!**/.agents/**" ,
26+ "!**/.claude/**" ,
27+ "!dist/**" ,
28+ "!node_modules/.vite-temp/**" ,
29+ "!storybook-static/**" ,
30+ ] ;
2331
2432// More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon
2533function subpathEntries ( ) : Record < string , string > {
@@ -78,30 +86,29 @@ export default defineConfig({
7886 run : {
7987 tasks : {
8088 build : {
81- command : "node ./scripts/ pack-retry.mjs " ,
82- input : [ { auto : true } , "!dist/**" , "!node_modules/.vite-temp/**" , "!storybook-static/**" ] ,
89+ command : "vp pack" ,
90+ input : taskInput ,
8391 output : [ "dist/**" ] ,
8492 } ,
8593 "build-storybook" : {
8694 command : "storybook build" ,
87- input : [ { auto : true } , "!dist/**" , "!node_modules/.vite-temp/**" , "!storybook-static/**" ] ,
95+ input : taskInput ,
8896 output : [ "storybook-static/**" ] ,
8997 } ,
9098 check : {
9199 command : "vp check" ,
92- input : [ { auto : true } , "!dist/**" , "!node_modules/.vite-temp/**" , "!storybook-static/**" ] ,
100+ input : taskInput ,
93101 output : [ ] ,
94102 } ,
95103 test : {
96104 command : "vp test" ,
97- input : [ { auto : true } , "!dist/**" , "!node_modules/.vite-temp/**" , "!storybook-static/**" ] ,
105+ input : taskInput ,
98106 output : [ ] ,
99107 } ,
100108 } ,
101109 } ,
102- // Keep vite's dev/test server out of nested agent worktrees (`.claude/worktrees/<name>`,
103- // full second checkouts living inside the workspace root). See the root `vite.config.ts`.
104- server : { watch : { ignored : [ "**/.claude/**" ] } } ,
110+ // Keep vite's dev/test server out of local agent state. See the root `vite.config.ts`.
111+ server : { watch : { ignored : agentIgnorePatterns } } ,
105112 // Pre-bundle every story's deps in a single optimizer pass at server start. Without this the
106113 // browser discovers deps lazily, so a late story importing a not-yet-bundled dep triggers a
107114 // mid-run re-optimize; that commits a new bundle, reloads the page, and 404s the module
@@ -116,7 +123,7 @@ export default defineConfig({
116123 // Vitest ignores `.gitignore`, so its file discovery would otherwise crawl those
117124 // worktree checkouts (each carries a duplicate copy of every story). The storybook
118125 // project below extends this config, so the exclude applies to it too.
119- exclude : [ ...configDefaults . exclude , "**/.claude/**" ] ,
126+ exclude : [ ...configDefaults . exclude , ... agentIgnorePatterns ] ,
120127 // The standard Storybook Vitest-addon project: one chromium browser instance running
121128 // every story as a test (render → play → a11y gate). See the addon docs:
122129 // https://storybook.js.org/docs/writing-tests/integrations/vitest-addon
0 commit comments