diff --git a/packages/features/bookings/Booker/components/BookEventForm/BookingFields.test.tsx b/packages/features/bookings/Booker/components/BookEventForm/BookingFields.test.tsx index 2b355232a47730..9f6909820f7b71 100644 --- a/packages/features/bookings/Booker/components/BookEventForm/BookingFields.test.tsx +++ b/packages/features/bookings/Booker/components/BookEventForm/BookingFields.test.tsx @@ -1,3 +1,5 @@ +import "@calcom/ui/__mocks__/ui"; + import { TooltipProvider } from "@radix-ui/react-tooltip"; import { render, fireEvent, screen } from "@testing-library/react"; import * as React from "react"; diff --git a/packages/features/form-builder/test-setup.ts b/packages/ui/__mocks__/ui.tsx similarity index 74% rename from packages/features/form-builder/test-setup.ts rename to packages/ui/__mocks__/ui.tsx index f959f6743b7dd8..8e34e41c0e81c5 100644 --- a/packages/features/form-builder/test-setup.ts +++ b/packages/ui/__mocks__/ui.tsx @@ -1,5 +1,4 @@ -import { cleanup } from "@testing-library/react"; -import { afterEach, vi } from "vitest"; +import { vi } from "vitest"; vi.mock("@calcom/ui", async (originalImport) => { const original = (await originalImport()) as Record; @@ -11,6 +10,4 @@ vi.mock("@calcom/ui", async (originalImport) => { }; }); -afterEach(() => { - cleanup(); -}); +export {}; diff --git a/packages/ui/package.json b/packages/ui/package.json index 87adc58ef1fe2e..58fd091feea904 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -11,7 +11,8 @@ "./components/icon/SatSymbol": "./components/icon/SatSymbol.tsx", "./components/icon/Spinner": "./components/icon/Spinner.tsx", "./components/unpublished-entity/UnpublishedEntity": "./components/unpublished-entity/index.ts", - "./components/form/timezone-select/TimezoneSelect": "./components/form/timezone-select/index.ts" + "./components/form/timezone-select/TimezoneSelect": "./components/form/timezone-select/index.ts", + "./__mocks__/ui": "./__mocks__/ui.tsx" }, "types": "./index.tsx", "license": "MIT", diff --git a/vitest.workspace.ts b/vitest.workspace.ts index bd6c576f0c6383..92a73c4f855ef9 100644 --- a/vitest.workspace.ts +++ b/vitest.workspace.ts @@ -156,14 +156,14 @@ const workspaces = packagedEmbedTestsOnly name: "@calcom/features/form-builder", include: ["packages/features/form-builder/**/*.{test,spec}.[jt]s?(x)"], environment: "jsdom", - setupFiles: ["@calcom/features/form-builder/test-setup.ts"], + setupFiles: ["packages/ui/components/test-setup.ts"], }, }, { test: { globals: true, name: "@calcom/features/bookings", - include: ["packages/features/bookings/**/*.{test,spec}.[jt]s?(x)"], + include: ["packages/features/bookings/**/*.{test,spec}.[jt]sx"], environment: "jsdom", setupFiles: ["packages/ui/components/test-setup.ts"], },