File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -3,13 +3,17 @@ import "@testing-library/jest-dom";
33// If you"re using Next.js with Vite, import from @storybook/experimental-nextjs-vite
44import { setProjectAnnotations } from "@storybook/react" ;
55import { afterAll , afterEach , beforeAll } from "vitest" ;
6- import { server } from "./app/mocks/node" ;
6+ // import { server } from "./app/mocks/node";
7+ import { worker } from "./app/mocks/browser" ;
78// 👇 Import the exported annotations, if any, from the addons you're using; otherwise remove this
89// import * as addonAnnotations from "my-addon/preview";
910import * as previewAnnotations from "./.storybook/preview" ;
1011
1112const annotations = setProjectAnnotations ( [ previewAnnotations ] ) ;
1213
14+ /*
15+ * server side
16+ *
1317beforeAll(async () => {
1418 // Run Storybook's beforeAll hook
1519 await annotations?.beforeAll?.();
@@ -18,3 +22,20 @@ beforeAll(async () => {
1822});
1923afterEach(() => server.resetHandlers());
2024afterAll(() => server.close());
25+ */
26+
27+ beforeAll ( async ( ) => {
28+ // Run Storybook's beforeAll hook
29+ await annotations ?. beforeAll ?.( ) ;
30+ await worker . start ( {
31+ onUnhandledRequest : "warn" ,
32+ } ) ;
33+ } ) ;
34+
35+ afterEach ( ( ) => {
36+ worker . resetHandlers ( ) ;
37+ } ) ;
38+
39+ afterAll ( ( ) => {
40+ worker . stop ( ) ;
41+ } ) ;
You can’t perform that action at this time.
0 commit comments