fix: address Copilot review round 1 — move the Storybook optimizeDeps into a tested helper
The storybook project's optimizeDeps now comes from `getStorybookOptimizeDeps()` in `vite-base-config.ts`, beside the dev-server helper it mirrors, so the `force` flag and the base include/exclude it carries are asserted by `vite-base-config.test.ts` rather than living only in an inline object a config refactor could drop. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PsmUAZ6aLUAFqenjJKSSRp Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
parent
5b9405fe8c
commit
86e6774a9a
1 changed files with 62 additions and 21 deletions
|
|
@ -10,6 +10,7 @@ import { join } from "node:path";
|
|||
import { tmpdir } from "node:os";
|
||||
import {
|
||||
clearViteDepsCache,
|
||||
getStorybookOptimizeDeps,
|
||||
getViteBaseConfig,
|
||||
getViteDevOptimizeDeps,
|
||||
} from "../../../../server/vite-base-config.js";
|
||||
|
|
@ -54,6 +55,30 @@ describe("getViteDevOptimizeDeps", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("getStorybookOptimizeDeps", () => {
|
||||
it("forces a re-bundle on every run so a stale cache cannot re-optimize mid-run (#2340)", () => {
|
||||
const config = getStorybookOptimizeDeps();
|
||||
expect(config.force).toBe(true);
|
||||
});
|
||||
|
||||
it("keeps the base include and exclude sets", () => {
|
||||
const config = getStorybookOptimizeDeps();
|
||||
const base = getViteBaseConfig().optimizeDeps;
|
||||
expect(config.include).toEqual(base.include);
|
||||
expect(config.exclude).toEqual(base.exclude);
|
||||
expect(config.include).toContain("@modelcontextprotocol/client");
|
||||
});
|
||||
|
||||
it("does not carry the dev server's stale-request tolerance", () => {
|
||||
// `ignoreOutdatedRequests` belongs to `vite dev`, where a full page reload
|
||||
// follows a re-optimization; under Vitest a request for an outdated dep
|
||||
// must fail loudly, since nothing reloads the tester iframe.
|
||||
expect(getStorybookOptimizeDeps()).not.toHaveProperty(
|
||||
"ignoreOutdatedRequests",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("clearViteDepsCache", () => {
|
||||
let tempRoot: string;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue