diff --git a/.agents/skills/api-types/SKILL.md b/.agents/skills/api-types/SKILL.md new file mode 100644 index 0000000000000..3d206497a2ce7 --- /dev/null +++ b/.agents/skills/api-types/SKILL.md @@ -0,0 +1,27 @@ +--- +name: api-types +description: Maintain Supabase API types. Use when changing generated API type declarations, OpenAPI schemas, or investigating API type deployment drift. +--- + +# API types + +The generated API contract has three specs: API v1, API v2, and Platform. Their committed outputs are `packages/api-types/types/api-v1.d.ts`, `packages/api-types/types/api-v2.d.ts`, and `packages/api-types/types/platform.d.ts`. + +## Update types + +1. Make the API/schema change and ensure it is deployed to production before relying on a type PR. Production is the merge-gate source of truth. +2. Run `pnpm api:codegen` against a running local API environment. It fetches all three local OpenAPI specs and updates the committed files. +3. Inspect and commit only the intended generated type changes. +4. Run `pnpm api:verify-types`. It fetches the three production OpenAPI specs, regenerates types with the repository tooling, and compares them with the committed files. + +Complete the update only when `pnpm api:verify-types` passes after the production deployment is available. + +## Interpret verification + +- A pass means the committed generated declarations match all three production specs at the time of the check. +- A mismatch means production and the committed files differ. If the API is not deployed, deploy it and rerun the check. If production is correct, regenerate and review the changed files. +- A fetch failure means the production schema endpoint could not be read; fix or retry the endpoint before treating the result as a type mismatch. + +## Pull requests + +The `Verify production API types` CI job runs when `packages/api-types/types/**` changes and performs the same production comparison. It is currently observational, not a required merge check. The `api-deploy-required` label is informational only. Still run the local verifier before requesting review and treat a failed CI verification as production drift that must be resolved. diff --git a/.github/workflows/label_prs.yml b/.github/workflows/label_prs.yml index 9e9ac01756e90..50af84c94579e 100644 --- a/.github/workflows/label_prs.yml +++ b/.github/workflows/label_prs.yml @@ -22,5 +22,5 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, - body: 'The `api-deploy-required` label was auto-applied to this PR because it updates the API types. Ensure that the new or updated API, if any, is deployed on production before **removing the label** and merging this PR.', + body: 'The `api-deploy-required` label was auto-applied to this PR because it updates the API types. The `Verify production API types` check reports whether the committed types match production; it is currently observational and does not block merging.', }) diff --git a/.github/workflows/validate-pr.yml b/.github/workflows/validate-pr.yml index 2ee49d84c8e90..1b10f526421d9 100644 --- a/.github/workflows/validate-pr.yml +++ b/.github/workflows/validate-pr.yml @@ -17,12 +17,6 @@ jobs: echo "PR blocked: [tag: do not merge]" exit 1 - - name: Tagged with 'api-deploy-required' - if: contains( github.event.pull_request.labels.*.name, 'api-deploy-required') - run: | - echo "PR blocked: [tag: api-deploy-required] — confirm the API is deployed in production, then remove the label." - exit 1 - - name: All good if: ${{ success() }} run: | diff --git a/.github/workflows/verify-production-api-types.yml b/.github/workflows/verify-production-api-types.yml new file mode 100644 index 0000000000000..bc99921ca89e3 --- /dev/null +++ b/.github/workflows/verify-production-api-types.yml @@ -0,0 +1,50 @@ +name: Verify production API types + +on: + pull_request: + types: [opened, reopened, synchronize] + +permissions: + contents: read + pull-requests: read + +jobs: + verify-production-api-types: + runs-on: ubuntu-latest + steps: + - id: changes + env: + GH_TOKEN: ${{ github.token }} + run: | + if gh api "repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" --paginate --jq '.[].filename' | grep -q '^packages/api-types/types/'; then + echo "api_types_changed=true" >> "$GITHUB_OUTPUT" + else + echo "api_types_changed=false" >> "$GITHUB_OUTPUT" + fi + + - name: Check out pull request + if: steps.changes.outputs.api_types_changed == 'true' + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 + with: + persist-credentials: false + + - name: Install pnpm + if: steps.changes.outputs.api_types_changed == 'true' + uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 + with: + run_install: false + + - name: Set up Node.js + if: steps.changes.outputs.api_types_changed == 'true' + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 + with: + node-version-file: '.nvmrc' + cache: pnpm + + - name: Install API types dependencies + if: steps.changes.outputs.api_types_changed == 'true' + run: pnpm install --frozen-lockfile --filter=api-types... + + - name: Verify production API types + if: steps.changes.outputs.api_types_changed == 'true' + run: pnpm --filter=api-types run verify-production-types diff --git a/.gitignore b/.gitignore index 2d930f8f779bb..48d58ae1ad031 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,8 @@ tmp *.swp coverage +# vitest reporter output (json/junit/html/attachments) +.vitest allure-results allure-report .nyc_output diff --git a/apps/docs/app/api/graphql/route.test.ts b/apps/docs/app/api/graphql/route.test.ts index e64a01da12470..357a64127be97 100644 --- a/apps/docs/app/api/graphql/route.test.ts +++ b/apps/docs/app/api/graphql/route.test.ts @@ -20,7 +20,6 @@ describe('/api/graphql POST basic error statuses', () => { }) beforeEach(() => { - vi.clearAllMocks() vi.spyOn(console, 'error').mockImplementation(() => {}) }) diff --git a/apps/docs/app/api/revalidate/route.test.ts b/apps/docs/app/api/revalidate/route.test.ts index 89eebe4508794..52c9eb6bd9279 100644 --- a/apps/docs/app/api/revalidate/route.test.ts +++ b/apps/docs/app/api/revalidate/route.test.ts @@ -59,7 +59,6 @@ describe('_handleRevalidateRequest', () => { afterEach(() => { process.env = originalEnv - vi.clearAllMocks() vi.useRealTimers() }) diff --git a/apps/docs/app/api/search/embeddings/route.test.ts b/apps/docs/app/api/search/embeddings/route.test.ts index 8cf06aa5c0b8b..ea125374bab8a 100644 --- a/apps/docs/app/api/search/embeddings/route.test.ts +++ b/apps/docs/app/api/search/embeddings/route.test.ts @@ -1,5 +1,5 @@ import { NextRequest } from 'next/server' -import { afterEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { POST } from './route' @@ -19,10 +19,6 @@ function makeRequest(body: unknown) { } describe('/api/search/embeddings', () => { - afterEach(() => { - vi.clearAllMocks() - }) - it('returns 400 when query is missing', async () => { const response = await POST(makeRequest({})) expect(response.status).toBe(400) diff --git a/apps/docs/app/api/search/fts/route.test.ts b/apps/docs/app/api/search/fts/route.test.ts index 04d947204c15f..883544100b90c 100644 --- a/apps/docs/app/api/search/fts/route.test.ts +++ b/apps/docs/app/api/search/fts/route.test.ts @@ -1,5 +1,5 @@ import { NextRequest } from 'next/server' -import { afterEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { POST } from './route' @@ -21,10 +21,6 @@ function makeRequest(body: unknown) { } describe('/api/search/fts', () => { - afterEach(() => { - vi.clearAllMocks() - }) - it('returns 400 when query is missing', async () => { const response = await POST(makeRequest({})) expect(response.status).toBe(400) diff --git a/apps/docs/content/guides/database/prisma.mdx b/apps/docs/content/guides/database/prisma.mdx index f690c7f63ceb3..17f83390eb550 100644 --- a/apps/docs/content/guides/database/prisma.mdx +++ b/apps/docs/content/guides/database/prisma.mdx @@ -103,9 +103,9 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t yarn add prisma tsx @types/pg --save-dev yarn add @prisma/client @prisma/adapter-pg dotenv pg - npx tsc --init + yarn tsc --init - npx prisma init + yarn prisma init ``` @@ -285,8 +285,8 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t ```bash - npx prisma migrate dev --name first_prisma_migration - npx prisma generate + yarn prisma migrate dev --name first_prisma_migration + yarn prisma generate ``` @@ -368,7 +368,7 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t ```bash - npx prisma db pull + yarn prisma db pull ``` Create a migration file @@ -378,7 +378,7 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t Synchronize the migrations ```bash - npx prisma migrate diff \ + yarn prisma migrate diff \ --from-empty \ --to-schema prisma/schema.prisma \ --script > prisma/migrations/0_init_supabase/migration.sql @@ -390,8 +390,8 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t ```bash - npx prisma migrate resolve --applied 0_init_supabase - npx prisma generate + yarn prisma migrate resolve --applied 0_init_supabase + yarn prisma generate ``` diff --git a/apps/docs/features/directives/Show.test.ts b/apps/docs/features/directives/Show.test.ts index 3fea57f501206..1a60f1bb0860b 100644 --- a/apps/docs/features/directives/Show.test.ts +++ b/apps/docs/features/directives/Show.test.ts @@ -1,6 +1,6 @@ import { mdxToMarkdown } from 'mdast-util-mdx' import { toMarkdown } from 'mdast-util-to-markdown' -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' +import { afterEach, describe, expect, it, vi } from 'vitest' import { type Feature } from 'common' import { showRemark } from './Show' @@ -14,10 +14,6 @@ vi.mock('common/enabled-features', () => ({ const { isFeatureEnabled } = await import('common/enabled-features') describe('$Show', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - afterEach(() => { vi.restoreAllMocks() }) diff --git a/apps/docs/features/docs/Reference.mdx.tsx b/apps/docs/features/docs/Reference.mdx.tsx index 1e63f8adb3d7b..2f3f846c9f9a6 100644 --- a/apps/docs/features/docs/Reference.mdx.tsx +++ b/apps/docs/features/docs/Reference.mdx.tsx @@ -41,14 +41,17 @@ const getRefMarkdown = cache_fullProcess_withDevCacheBust( interface MDXRemoteRefsProps { source: string + codeBlockProps?: Partial> } -function MDXRemoteRefs({ source }: MDXRemoteRefsProps) { +function MDXRemoteRefs({ source, codeBlockProps }: MDXRemoteRefsProps) { const refComponents = { ...components, // Override the CodeBlock used for normal guides to skip type generation // because it is too resource-intensive - pre: (props: ComponentProps) => , + pre: (props: ComponentProps) => ( + + ), RefSubLayout, CliGlobalFlagsHandler, } diff --git a/apps/docs/features/docs/Reference.sections.tsx b/apps/docs/features/docs/Reference.sections.tsx index cbced0f844c01..a95baa199b0e5 100644 --- a/apps/docs/features/docs/Reference.sections.tsx +++ b/apps/docs/features/docs/Reference.sections.tsx @@ -548,7 +548,15 @@ async function FunctionSection({ {examples.map((example) => ( - +
+ +
{'data' in example && !!example.data?.sql && ( diff --git a/apps/docs/features/docs/Reference.ui.tsx b/apps/docs/features/docs/Reference.ui.tsx index 42c984a41e6c8..441976c8d35d7 100644 --- a/apps/docs/features/docs/Reference.ui.tsx +++ b/apps/docs/features/docs/Reference.ui.tsx @@ -12,6 +12,7 @@ import { ReferenceSectionWrapper } from '~/features/docs/Reference.ui.client' import { normalizeMarkdown } from '~/features/docs/Reference.utils' import { isEqual } from 'lodash-es' import { ChevronRight, XCircle } from 'lucide-react' +import { fromMarkdown } from 'mdast-util-from-markdown' import type { HTMLAttributes, PropsWithChildren } from 'react' import ReactMarkdown from 'react-markdown' import { Badge, cn, Collapsible, CollapsibleContent, CollapsibleTrigger } from 'ui' @@ -115,32 +116,57 @@ export function StickyHeader({ title, monoFont = false, className }: StickyHeade } export function CollapsibleDetails({ title, content }: { title: string; content: string }) { + const blocks = fromMarkdown(content).children + const isCodeOnly = blocks.length === 1 && blocks[0].type === 'code' + return ( - + - {title} + - +
+ +
) diff --git a/apps/docs/features/ui/CodeBlock/CodeBlock.tsx b/apps/docs/features/ui/CodeBlock/CodeBlock.tsx index 4ecafb77f3307..1d1c4d3268d72 100644 --- a/apps/docs/features/ui/CodeBlock/CodeBlock.tsx +++ b/apps/docs/features/ui/CodeBlock/CodeBlock.tsx @@ -27,6 +27,7 @@ export async function CodeBlock({ children, skipTypeGeneration, hideControls = false, + compact = false, }: PropsWithChildren<{ className?: string lang?: string @@ -34,6 +35,7 @@ export async function CodeBlock({ contents?: string skipTypeGeneration?: boolean hideControls?: boolean + compact?: boolean }>) { let code = (contents || extractCode(children)).trim() const lang = tryToBundledLanguage(langSetting || '') || extractLang(children) @@ -63,8 +65,8 @@ export async function CodeBlock({ 'relative', 'not-prose', 'w-full', - 'border border-default rounded-lg', - 'bg-200 shadow-codeblock', + compact ? 'border-0 my-0!' : 'border border-default rounded-lg shadow-codeblock', + 'bg-200', 'text-sm', className )} @@ -72,7 +74,8 @@ export async function CodeBlock({
{ - vi.clearAllMocks() vi.resetModules() }) diff --git a/apps/docs/package.json b/apps/docs/package.json index f0f734c7c57c6..519f9a455d311 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -143,7 +143,7 @@ "@graphql-codegen/typescript-resolvers": "4.5.0", "@redocly/cli": "^2.26.0", "@supabase/supa-mdx-lint": "0.3.2", - "@testing-library/react": "^16.0.0", + "@testing-library/react": "^16.3.3", "@types/common-tags": "^1.8.4", "@types/estree": "1.0.5", "@types/graphql-validation-complexity": "^0.4.4", @@ -182,7 +182,6 @@ "typescript": "catalog:", "unist-util-visit-parents": "5.1.3", "vite": "catalog:", - "vite-tsconfig-paths": "catalog:", "vitest": "catalog:" } } diff --git a/apps/docs/vitest.config.ts b/apps/docs/vitest.config.ts index 30c7c2703b9ad..ba0c0334250a0 100644 --- a/apps/docs/vitest.config.ts +++ b/apps/docs/vitest.config.ts @@ -1,19 +1,11 @@ -import tsconfigPaths from 'vite-tsconfig-paths' import { defineConfig } from 'vitest/config' export default defineConfig({ + resolve: { tsconfigPaths: true }, test: { // Exclude examples from test discovery (does not affect tsconfig scanning) exclude: ['examples/**/*', '**/node_modules/**'], setupFiles: ['vitest.setup.ts'], globalSetup: ['vitest.globalSetup.ts'], }, - // Restrict tsconfig-paths to only use this app's tsconfig - plugins: [ - tsconfigPaths({ - root: import.meta.dirname, - // Prevent scanning tsconfig files in subfolders like examples/** - projects: ['tsconfig.json'], - }), - ], }) diff --git a/apps/docs/vitest.setup.ts b/apps/docs/vitest.setup.ts index ef03c799e6a4e..4256314e4feb6 100644 --- a/apps/docs/vitest.setup.ts +++ b/apps/docs/vitest.setup.ts @@ -1,5 +1,11 @@ import { afterAll, beforeAll, vi } from 'vitest' +// Prevent errors about importing server-only modules from Client Components. +// Must stay at module scope: Vitest hoists `vi.mock` above imports. +vi.mock('server-only', () => { + return {} +}) + let oldEnv: NodeJS.ProcessEnv beforeAll(() => { @@ -11,14 +17,8 @@ beforeAll(() => { NEXT_PUBLIC_SUPABASE_ANON_KEY: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0', } - - // Prevent errors about importing server-only modules from Client Components - vi.mock('server-only', () => { - return {} - }) }) afterAll(() => { process.env = oldEnv - vi.doUnmock('server-only') }) diff --git a/apps/lite-studio/package.json b/apps/lite-studio/package.json index a149499c2591f..a0106d4b28087 100644 --- a/apps/lite-studio/package.json +++ b/apps/lite-studio/package.json @@ -29,7 +29,6 @@ "config": "workspace:*", "tailwindcss": "catalog:", "tsconfig": "workspace:*", - "vite": "^7.3.2", - "vite-tsconfig-paths": "catalog:" + "vite": "^7.3.2" } } diff --git a/apps/lite-studio/vite.config.ts b/apps/lite-studio/vite.config.ts index 0c4c883e7e700..7f827bbf9079d 100644 --- a/apps/lite-studio/vite.config.ts +++ b/apps/lite-studio/vite.config.ts @@ -1,14 +1,7 @@ import { reactRouter } from '@react-router/dev/vite' import tailwindcss from '@tailwindcss/vite' import { defineConfig } from 'vite' -import tsconfigPaths from 'vite-tsconfig-paths' export default defineConfig({ - plugins: [ - reactRouter(), - tsconfigPaths({ - root: '.', - }), - tailwindcss(), - ], + plugins: [reactRouter(), tailwindcss()], }) diff --git a/apps/studio/components/interfaces/APIKeys/CreateAPIKeyDialogs.test.tsx b/apps/studio/components/interfaces/APIKeys/CreateAPIKeyDialogs.test.tsx index 15396d5e0e631..6eb3d5b942227 100644 --- a/apps/studio/components/interfaces/APIKeys/CreateAPIKeyDialogs.test.tsx +++ b/apps/studio/components/interfaces/APIKeys/CreateAPIKeyDialogs.test.tsx @@ -38,7 +38,6 @@ vi.mock('@/data/api-keys/api-key-create-mutation', () => ({ describe('API key create dialogs', () => { beforeEach(() => { - vi.clearAllMocks() mockUseQueryState.mockReturnValue(['', mockSetVisible]) }) diff --git a/apps/studio/components/interfaces/Account/Preferences/AccountIdentities.test.tsx b/apps/studio/components/interfaces/Account/Preferences/AccountIdentities.test.tsx index 479d1664acd33..f2eabc7332305 100644 --- a/apps/studio/components/interfaces/Account/Preferences/AccountIdentities.test.tsx +++ b/apps/studio/components/interfaces/Account/Preferences/AccountIdentities.test.tsx @@ -107,7 +107,6 @@ const openAddPasswordDialog = async () => { describe('AccountIdentities', () => { beforeEach(() => { - vi.clearAllMocks() refreshSessionMock.mockResolvedValue({ data: {}, error: null }) signOutMock.mockResolvedValue({ error: null }) useFlagMock.mockImplementation((name: string) => name === 'enableAccountPassword') diff --git a/apps/studio/components/interfaces/App/CommandMenu/ApiKeys.test.tsx b/apps/studio/components/interfaces/App/CommandMenu/ApiKeys.test.tsx index 409d837460880..be1335a8ec89d 100644 --- a/apps/studio/components/interfaces/App/CommandMenu/ApiKeys.test.tsx +++ b/apps/studio/components/interfaces/App/CommandMenu/ApiKeys.test.tsx @@ -80,8 +80,6 @@ async function renderCommandPage() { describe('useApiKeysCommands', () => { beforeEach(() => { - vi.clearAllMocks() - mockUseAsyncCheckPermissions.mockReturnValue({ can: true }) mockUseSelectedProjectQuery.mockReturnValue({ data: { id: 1, ref: 'default', name: 'default' }, diff --git a/apps/studio/components/interfaces/Auth/EmailTemplates/TemplateEditor.test.tsx b/apps/studio/components/interfaces/Auth/EmailTemplates/TemplateEditor.test.tsx index eff4d0e4d7700..8b7b6653b93fd 100644 --- a/apps/studio/components/interfaces/Auth/EmailTemplates/TemplateEditor.test.tsx +++ b/apps/studio/components/interfaces/Auth/EmailTemplates/TemplateEditor.test.tsx @@ -134,7 +134,6 @@ const renderTemplateEditor = ({ describe('TemplateEditor reset to default', () => { beforeEach(() => { - vi.clearAllMocks() validateSpamMock.mockImplementation((_vars, callbacks) => callbacks?.onSuccess?.({ rules: [] })) }) diff --git a/apps/studio/components/interfaces/Auth/RedirectUrls/AddNewURLModal.test.tsx b/apps/studio/components/interfaces/Auth/RedirectUrls/AddNewURLModal.test.tsx index 38dbdef939d00..f79fa60b61067 100644 --- a/apps/studio/components/interfaces/Auth/RedirectUrls/AddNewURLModal.test.tsx +++ b/apps/studio/components/interfaces/Auth/RedirectUrls/AddNewURLModal.test.tsx @@ -55,7 +55,6 @@ vi.mock('sonner', () => ({ describe('AddNewURLModal', () => { beforeEach(() => { - vi.clearAllMocks() useAuthConfigUpdateMutationMock.mockReturnValue({ mutate: mutateMock, isPending: false, diff --git a/apps/studio/components/interfaces/Auth/SiteUrl/SiteUrl.test.tsx b/apps/studio/components/interfaces/Auth/SiteUrl/SiteUrl.test.tsx index 5d949e8dc71e8..cb79181477338 100644 --- a/apps/studio/components/interfaces/Auth/SiteUrl/SiteUrl.test.tsx +++ b/apps/studio/components/interfaces/Auth/SiteUrl/SiteUrl.test.tsx @@ -36,8 +36,6 @@ const renderSiteUrl = () => customRender() describe('SiteUrl', () => { beforeEach(() => { - vi.clearAllMocks() - addAPIMock({ method: 'get', path: '/platform/auth/:ref/config', diff --git a/apps/studio/components/interfaces/Auth/Users/UserPanel.test.tsx b/apps/studio/components/interfaces/Auth/Users/UserPanel.test.tsx index 23b4caea738d3..47350540faab5 100644 --- a/apps/studio/components/interfaces/Auth/Users/UserPanel.test.tsx +++ b/apps/studio/components/interfaces/Auth/Users/UserPanel.test.tsx @@ -1,7 +1,7 @@ import { screen } from '@testing-library/react' import { http, HttpResponse } from 'msw' import { ResizablePanelGroup } from 'ui' -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { UserPanel } from './UserPanel' import type { User } from '@/data/auth/users-infinite-query' @@ -69,10 +69,6 @@ const renderPanel = (disabledFeatures: string[] = []) => { } describe('UserPanel', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - it('shows the Logs tab when logs:all is enabled', async () => { renderPanel([]) diff --git a/apps/studio/components/interfaces/Billing/Payment/PaymentMethods/PaymentMethods.test.tsx b/apps/studio/components/interfaces/Billing/Payment/PaymentMethods/PaymentMethods.test.tsx index 29dbe25a73c10..b1325eefd02f0 100644 --- a/apps/studio/components/interfaces/Billing/Payment/PaymentMethods/PaymentMethods.test.tsx +++ b/apps/studio/components/interfaces/Billing/Payment/PaymentMethods/PaymentMethods.test.tsx @@ -56,7 +56,6 @@ vi.mock('./DeletePaymentMethodModal', () => ({ describe('PaymentMethods', () => { beforeEach(() => { - vi.clearAllMocks() mockSelectedOrganization.mockReturnValue( createMockOrganization({ slug: 'stripe-org', diff --git a/apps/studio/components/interfaces/ConnectButton/Connect.Commands.test.tsx b/apps/studio/components/interfaces/ConnectButton/Connect.Commands.test.tsx index 057f5aa29dc93..36e929891e5aa 100644 --- a/apps/studio/components/interfaces/ConnectButton/Connect.Commands.test.tsx +++ b/apps/studio/components/interfaces/ConnectButton/Connect.Commands.test.tsx @@ -39,7 +39,6 @@ vi.mock('@/hooks/misc/useSelectedProject', () => ({ describe('useConnectCommands', () => { beforeEach(() => { - vi.clearAllMocks() mockUseSelectedProjectQuery.mockReturnValue({ data: { status: PROJECT_STATUS.ACTIVE_HEALTHY }, }) diff --git a/apps/studio/components/interfaces/ConnectSheet/__tests__/useConnectSheetShortcut.test.ts b/apps/studio/components/interfaces/ConnectSheet/__tests__/useConnectSheetShortcut.test.ts index d0b32bbe16b2f..4570149bbcd65 100644 --- a/apps/studio/components/interfaces/ConnectSheet/__tests__/useConnectSheetShortcut.test.ts +++ b/apps/studio/components/interfaces/ConnectSheet/__tests__/useConnectSheetShortcut.test.ts @@ -42,7 +42,6 @@ vi.mock('@/state/shortcuts/useShortcut', () => ({ describe('useConnectSheetShortcut', () => { beforeEach(() => { - vi.clearAllMocks() mockUseSelectedProjectQuery.mockReturnValue({ data: { status: PROJECT_STATUS.ACTIVE_HEALTHY }, }) diff --git a/apps/studio/components/interfaces/Database/Publications/PublicationsAvailability.test.tsx b/apps/studio/components/interfaces/Database/Publications/PublicationsAvailability.test.tsx index 244222531a937..2594bf39ed06a 100644 --- a/apps/studio/components/interfaces/Database/Publications/PublicationsAvailability.test.tsx +++ b/apps/studio/components/interfaces/Database/Publications/PublicationsAvailability.test.tsx @@ -1,5 +1,5 @@ import { render, screen } from '@testing-library/react' -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { PublicationsAvailability } from './PublicationsAvailability' @@ -12,10 +12,6 @@ vi.mock('@/hooks/misc/useHighAvailability', () => ({ })) describe('PublicationsAvailability', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - it('shows the disabled empty state instead of page content for High Availability projects', () => { mockUseHighAvailability.mockReturnValue({ isHighAvailability: true }) diff --git a/apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.test.tsx b/apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.test.tsx index df407d369c887..953cf63bd6589 100644 --- a/apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.test.tsx +++ b/apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/index.test.tsx @@ -251,7 +251,6 @@ vi.mock('@/components/interfaces/Storage/AnalyticsBuckets/CreateAnalyticsBucketS describe('DestinationForm edit submission', () => { beforeEach(() => { - vi.clearAllMocks() pipelineTableIds = [101, 999] mocks.submitPipeline.mockResolvedValue(undefined) mocks.validateConfiguration.mockResolvedValue({ canContinue: true, warnings: [] }) diff --git a/apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/useDestinationForm.test.tsx b/apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/useDestinationForm.test.tsx index ea4832617bb67..32771ae9e241f 100644 --- a/apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/useDestinationForm.test.tsx +++ b/apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationForm/useDestinationForm.test.tsx @@ -85,7 +85,6 @@ const formData = { describe('useDestinationForm validation', () => { beforeEach(() => { - vi.clearAllMocks() mocks.validateDestination.mockResolvedValue({ validation_failures: [] }) mocks.validatePipeline.mockResolvedValue({ validation_failures: [] }) }) diff --git a/apps/studio/components/interfaces/DiskManagement/ComputeAndDiskUsageCharts.test.tsx b/apps/studio/components/interfaces/DiskManagement/ComputeAndDiskUsageCharts.test.tsx index 155dc75c4ead6..c66f7bfcada4d 100644 --- a/apps/studio/components/interfaces/DiskManagement/ComputeAndDiskUsageCharts.test.tsx +++ b/apps/studio/components/interfaces/DiskManagement/ComputeAndDiskUsageCharts.test.tsx @@ -143,7 +143,6 @@ const buildUsageResponse = ({ describe('ComputeAndDiskUsageCharts', () => { beforeEach(() => { - vi.clearAllMocks() mockUseProject.mockReturnValue({ data: { infra_compute_size: 'micro' } }) mockUseInfraMonitoringAttributesQuery.mockReturnValue({ data: buildUsageResponse(), diff --git a/apps/studio/components/interfaces/ErrorHandling/ErrorMatcher.test.tsx b/apps/studio/components/interfaces/ErrorHandling/ErrorMatcher.test.tsx index d3f551ce4d50f..22d004f1056ee 100644 --- a/apps/studio/components/interfaces/ErrorHandling/ErrorMatcher.test.tsx +++ b/apps/studio/components/interfaces/ErrorHandling/ErrorMatcher.test.tsx @@ -1,5 +1,5 @@ import { render, screen } from '@testing-library/react' -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { ErrorMatcher } from './ErrorMatcher' import { ConnectionTimeoutError } from '@/types/api-errors' @@ -20,8 +20,6 @@ vi.mock('./RestartProjectDialog', () => ({ })) describe('ErrorMatcher', () => { - beforeEach(() => vi.clearAllMocks()) - it('renders the provided title and error message', () => { render( { @@ -14,73 +17,77 @@ export const ExplorerHomeTab = () => { const [value, setValue] = useState('') return ( -
-
-
-

Explore your project

-

- Ask the Assistant about your data, or begin with a new resource. -

-
- - setValue(e.target.value)} - onSubmit={(message) => createChat({ initialMessage: message })} - /> - -
-
- } - title="Run SQL" - description="Write and run an ad-hoc query" - bgColor="bg-blue-500" - onClick={() => createQuery()} - /> - } - title="Create a notebook" - description="Combine notes, queries, and results" - bgColor="bg-blue-500" - onClick={() => createNotebook()} - /> +
+
+
+
+

Run SQL. Chat with your project. Create a Notebook

-
-
-

Start with a template

+ setValue(e.target.value)} + onSubmit={(message) => createChat({ initialMessage: message })} + /> + -
- {NOTEBOOK_TEMPLATES.map((template) => ( +
+
} - title={template.title} - description={template.description} + icon={} + title="Run SQL" + description="Write and run an ad-hoc query" bgColor="bg-blue-500" - onClick={() => - createNotebook({ name: template.title, cells: template.buildCells() }) - } + onClick={() => createQuery()} /> - ))} - {CHAT_TEMPLATES.map((template) => ( } - title={template.title} - description={template.description} + icon={} + title="Create a notebook" + description="Combine notes, queries, and results" bgColor="bg-blue-500" - onClick={() => - createChat({ name: template.title, initialMessage: template.initialMessage }) - } + onClick={() => createNotebook()} /> - ))} -
-
+
+
+ +
+

Start with a template

+ +
+ {NOTEBOOK_TEMPLATES.map((template) => ( + } + title={template.title} + description={template.description} + bgColor="bg-blue-500" + onClick={() => + createNotebook({ name: template.title, cells: template.buildCells() }) + } + /> + ))} + {CHAT_TEMPLATES.map((template) => ( + } + title={template.title} + bgColor="bg-blue-500" + onClick={() => + createChat({ name: template.title, initialMessage: template.initialMessage }) + } + /> + ))} +
+
+
) diff --git a/apps/studio/components/interfaces/Explorer/MarkdownCell.tsx b/apps/studio/components/interfaces/Explorer/MarkdownCell.tsx index c2629d153bf5b..42319c09ea44f 100644 --- a/apps/studio/components/interfaces/Explorer/MarkdownCell.tsx +++ b/apps/studio/components/interfaces/Explorer/MarkdownCell.tsx @@ -55,7 +55,7 @@ export const MarkdownCell = ({ cell, onEdit }: MarkdownCellProps) => { id={cell._id} actions={} gripDropdownContent={} - gripClassName="mt-1.5 opacity-0 group-hover:opacity-100 has-[[data-state=open]]:opacity-100 transition" + gripClassName="mt-1.5 sm:opacity-0 group-hover:opacity-100 has-[[data-state=open]]:opacity-100 transition" > {isEditing ? (
(function id={cell._id} actions={} gripDropdownContent={} - gripClassName="mt-2 opacity-0 group-hover:opacity-100 has-[[data-state=open]]:opacity-100 transition" + gripClassName="mt-2 sm:opacity-0 group-hover:opacity-100 has-[[data-state=open]]:opacity-100 transition" > ({ describe('QueryResultError (self-hosted)', () => { beforeEach(() => { - vi.clearAllMocks() mocks.useParams.mockReturnValue({ ref: 'default' }) addAPIMock({ method: 'get', diff --git a/apps/studio/components/interfaces/Explorer/QueryEditor/QueryResultError.test.tsx b/apps/studio/components/interfaces/Explorer/QueryEditor/QueryResultError.test.tsx index f7d6b75c223b4..7b7f1732bb1e6 100644 --- a/apps/studio/components/interfaces/Explorer/QueryEditor/QueryResultError.test.tsx +++ b/apps/studio/components/interfaces/Explorer/QueryEditor/QueryResultError.test.tsx @@ -52,7 +52,6 @@ vi.mock('@/data/config/project-settings-v2-query', () => ({ describe('QueryResultError', () => { beforeEach(() => { - vi.clearAllMocks() mocks.useParams.mockReturnValue({ ref: 'default' }) mocks.useOrgSubscriptionQuery.mockReturnValue({ data: undefined, isSuccess: true }) mocks.useProjectSettingsV2Query.mockReturnValue({ data: undefined, isSuccess: true }) diff --git a/apps/studio/components/interfaces/Explorer/__tests__/ExplorerChatTab.test.tsx b/apps/studio/components/interfaces/Explorer/__tests__/ExplorerChatTab.test.tsx index 7171a7832041a..b7e5b1fa323d3 100644 --- a/apps/studio/components/interfaces/Explorer/__tests__/ExplorerChatTab.test.tsx +++ b/apps/studio/components/interfaces/Explorer/__tests__/ExplorerChatTab.test.tsx @@ -79,7 +79,6 @@ vi.mock('@/components/ui/AIAssistantPanel/AssistantChat', () => ({ describe('ExplorerChatTab', () => { beforeEach(() => { - vi.clearAllMocks() mocks.useParams.mockReturnValue({ ref: 'default', id: 'chat-1' }) mocks.assistantSnapshot.mockReturnValue({ isInitialized: true, diff --git a/apps/studio/components/interfaces/Explorer/__tests__/hooks.test.tsx b/apps/studio/components/interfaces/Explorer/__tests__/hooks.test.tsx index 8398181396a1d..23824ccfe80b3 100644 --- a/apps/studio/components/interfaces/Explorer/__tests__/hooks.test.tsx +++ b/apps/studio/components/interfaces/Explorer/__tests__/hooks.test.tsx @@ -45,7 +45,6 @@ vi.mock('@/state/ai-assistant-state', () => ({ describe('useCreateChat', () => { beforeEach(() => { - vi.clearAllMocks() mockWhenInitialized.mockImplementation(() => Promise.resolve()) }) @@ -112,10 +111,6 @@ describe('useCreateChat', () => { }) describe('useCreateQuery', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - it('creates a draft and opens it as an Explorer query tab', () => { const { result } = renderHook(() => useCreateQuery()) diff --git a/apps/studio/components/interfaces/Explorer/templates.ts b/apps/studio/components/interfaces/Explorer/templates.ts index 498f958b82417..31e33055af823 100644 --- a/apps/studio/components/interfaces/Explorer/templates.ts +++ b/apps/studio/components/interfaces/Explorer/templates.ts @@ -1,30 +1,6 @@ import { createLogCellSkeleton, createMarkdownCellSkeleton, createQueryCellSkeleton } from './utils' import type { Notebooks } from '@/types' -export type ChatTemplate = { - title: string - description: string - initialMessage: string -} - -export const CHAT_TEMPLATES: ChatTemplate[] = [ - { - title: 'Generate sample data', - description: 'Chat template', - initialMessage: 'Generate sample data for a blog with users, posts, and comments tables.', - }, - { - title: 'Set up RLS policies', - description: 'Chat template', - initialMessage: 'Create RLS policies to ensure users can only access their own data.', - }, - { - title: 'Build a notebook', - description: 'Chat template', - initialMessage: 'Build me a notebook that tracks weekly signups and active users.', - }, -] - export type NotebookTemplate = { title: string description: string diff --git a/apps/studio/components/interfaces/JwtSecrets/jwt-secret-keys-table/action-panel.test.tsx b/apps/studio/components/interfaces/JwtSecrets/jwt-secret-keys-table/action-panel.test.tsx index 7ed2c4486b8a2..9589e6730e759 100644 --- a/apps/studio/components/interfaces/JwtSecrets/jwt-secret-keys-table/action-panel.test.tsx +++ b/apps/studio/components/interfaces/JwtSecrets/jwt-secret-keys-table/action-panel.test.tsx @@ -1,6 +1,6 @@ import { render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { ActionPanel } from './action-panel' import { SHORTCUT_IDS } from '@/state/shortcuts/registry' @@ -14,10 +14,6 @@ vi.mock('@/components/ui/Shortcut', () => ({ })) describe('ActionPanel', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - it('wraps the action button with a shortcut when one is provided', async () => { const user = userEvent.setup() const onClick = vi.fn() diff --git a/apps/studio/components/interfaces/JwtSecrets/jwt-secret-keys-table/create-key-dialog.test.tsx b/apps/studio/components/interfaces/JwtSecrets/jwt-secret-keys-table/create-key-dialog.test.tsx index ea5443d2d2683..582d8a4b9c2e7 100644 --- a/apps/studio/components/interfaces/JwtSecrets/jwt-secret-keys-table/create-key-dialog.test.tsx +++ b/apps/studio/components/interfaces/JwtSecrets/jwt-secret-keys-table/create-key-dialog.test.tsx @@ -1,6 +1,6 @@ import { render, screen } from '@testing-library/react' import { Dialog, DialogContent } from 'ui' -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { CreateKeyDialog } from './create-key-dialog' import { SHORTCUT_IDS } from '@/state/shortcuts/registry' @@ -25,10 +25,6 @@ vi.mock('sonner', () => ({ })) describe('CreateKeyDialog', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - it('wraps the create standby key button with the submit shortcut', () => { render( diff --git a/apps/studio/components/interfaces/LocalDropdown.test.tsx b/apps/studio/components/interfaces/LocalDropdown.test.tsx index 7cdfdb91a9dd7..800a8dce2efee 100644 --- a/apps/studio/components/interfaces/LocalDropdown.test.tsx +++ b/apps/studio/components/interfaces/LocalDropdown.test.tsx @@ -182,7 +182,6 @@ vi.mock('ui', async () => { describe('LocalDropdown', () => { beforeEach(() => { - vi.clearAllMocks() mockUseDevToolbar.mockReturnValue({ isAvailable: false, isEnabled: false, diff --git a/apps/studio/components/interfaces/LogDrains/LogDrainDestinationSheetForm.test.tsx b/apps/studio/components/interfaces/LogDrains/LogDrainDestinationSheetForm.test.tsx index 0a2fc18402346..741027c76e7e8 100644 --- a/apps/studio/components/interfaces/LogDrains/LogDrainDestinationSheetForm.test.tsx +++ b/apps/studio/components/interfaces/LogDrains/LogDrainDestinationSheetForm.test.tsx @@ -77,8 +77,6 @@ const submitForm = () => describe('LogDrainDestinationSheetForm', () => { beforeEach(() => { - vi.clearAllMocks() - useFlagMock.mockReturnValue(true) useParamsMock.mockReturnValue({ ref: 'project-ref' }) useLogDrainsQueryMock.mockReturnValue({ data: [] }) diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/BillingCustomerData/BillingCustomerData.test.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/BillingCustomerData/BillingCustomerData.test.tsx index 203c3879cc1fa..6fd1588534463 100644 --- a/apps/studio/components/interfaces/Organization/BillingSettings/BillingCustomerData/BillingCustomerData.test.tsx +++ b/apps/studio/components/interfaces/Organization/BillingSettings/BillingCustomerData/BillingCustomerData.test.tsx @@ -106,7 +106,6 @@ vi.mock('@/components/ui/PartnerManagedResource', () => ({ describe('BillingCustomerData', () => { beforeEach(() => { - vi.clearAllMocks() mockSelectedOrganization.mockReturnValue( createMockOrganization({ slug: 'stripe-org', diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/BillingEmail.test.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/BillingEmail.test.tsx index a5692cdce14e2..68329323d156d 100644 --- a/apps/studio/components/interfaces/Organization/BillingSettings/BillingEmail.test.tsx +++ b/apps/studio/components/interfaces/Organization/BillingSettings/BillingEmail.test.tsx @@ -94,7 +94,6 @@ const removeRecipient = (email: string) => { describe('BillingEmail', () => { beforeEach(() => { - vi.clearAllMocks() mockCheckPermissions.mockImplementation(() => ({ can: true, isSuccess: true })) }) diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/PlanUpdateSidePanel.test.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/PlanUpdateSidePanel.test.tsx index 3607d413e6091..a35f2891d89ea 100644 --- a/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/PlanUpdateSidePanel.test.tsx +++ b/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/PlanUpdateSidePanel.test.tsx @@ -152,7 +152,6 @@ vi.mock('@/hooks/misc/useTrackExperimentExposure', () => ({ describe('PlanUpdateSidePanel', () => { beforeEach(() => { - vi.clearAllMocks() mockIsPlatform.value = true mockFeatureFlags.mockReturnValue({ posthog: {}, configcat: {}, hasLoaded: true }) mockUsePHFlag.mockReturnValue('control') diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/Subscription.test.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/Subscription.test.tsx index 4ce21d8f9bb74..34978b2375ac6 100644 --- a/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/Subscription.test.tsx +++ b/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/Subscription.test.tsx @@ -47,7 +47,6 @@ vi.mock('./PlanUpdateSidePanel', () => ({ describe('Subscription', () => { beforeEach(() => { - vi.clearAllMocks() mockSubscription.mockReturnValue({ data: { plan: { id: 'free', name: 'Free' }, diff --git a/apps/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.test.tsx b/apps/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.test.tsx index 05f922830c8c8..9921530f961a5 100644 --- a/apps/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.test.tsx +++ b/apps/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.test.tsx @@ -75,7 +75,6 @@ const createMockInvoiceWithoutPdf = (): Invoice => { describe('InvoicesSettings', () => { beforeEach(() => { - vi.clearAllMocks() mockSelectedOrganization.mockReturnValue( createMockOrganization({ slug: 'stripe-org', diff --git a/apps/studio/components/interfaces/Organization/Usage/Usage.test.tsx b/apps/studio/components/interfaces/Organization/Usage/Usage.test.tsx index 9718945acbcdb..a13728da3022e 100644 --- a/apps/studio/components/interfaces/Organization/Usage/Usage.test.tsx +++ b/apps/studio/components/interfaces/Organization/Usage/Usage.test.tsx @@ -40,8 +40,6 @@ vi.mock('@/data/subscriptions/org-subscription-query', () => ({ describe('Usage', () => { beforeEach(() => { - vi.clearAllMocks() - mockUseAsyncCheckPermissions.mockReturnValue({ can: true, isLoading: false }) mockUseProjectDetailQuery.mockReturnValue({ data: { diff --git a/apps/studio/components/interfaces/OrganizationInvite/OrganizationInvite.test.tsx b/apps/studio/components/interfaces/OrganizationInvite/OrganizationInvite.test.tsx index a76d7420e1f22..86bdeed54a04b 100644 --- a/apps/studio/components/interfaces/OrganizationInvite/OrganizationInvite.test.tsx +++ b/apps/studio/components/interfaces/OrganizationInvite/OrganizationInvite.test.tsx @@ -116,7 +116,6 @@ function setSignedInDefaults() { describe('OrganizationInvite', () => { beforeEach(() => { - vi.clearAllMocks() setSignedInDefaults() }) diff --git a/apps/studio/components/interfaces/Platform/Webhooks/PlatformWebhooksEndpointSheet.test.tsx b/apps/studio/components/interfaces/Platform/Webhooks/PlatformWebhooksEndpointSheet.test.tsx index 82dee7c35d302..417f4740ad52e 100644 --- a/apps/studio/components/interfaces/Platform/Webhooks/PlatformWebhooksEndpointSheet.test.tsx +++ b/apps/studio/components/interfaces/Platform/Webhooks/PlatformWebhooksEndpointSheet.test.tsx @@ -1,7 +1,7 @@ import { fireEvent, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' import type { ComponentProps } from 'react' -import { afterEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import type { WebhookEndpoint } from './PlatformWebhooks.types' import { PlatformWebhooksEndpointSheet, toEndpointPayload } from './PlatformWebhooksEndpointSheet' @@ -65,10 +65,6 @@ const findEventTypeCheckbox = (eventType: string) => name: new RegExp(eventType.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')), }) describe('PlatformWebhooksEndpointSheet', () => { - afterEach(() => { - vi.clearAllMocks() - }) - it('prefills the name field when creating an endpoint', async () => { renderEndpointSheet() diff --git a/apps/studio/components/interfaces/Realtime/RealtimeSettings.test.tsx b/apps/studio/components/interfaces/Realtime/RealtimeSettings.test.tsx index 09af13e35954c..9ecb2680e9509 100644 --- a/apps/studio/components/interfaces/Realtime/RealtimeSettings.test.tsx +++ b/apps/studio/components/interfaces/Realtime/RealtimeSettings.test.tsx @@ -84,8 +84,6 @@ const REALTIME_ENTITLEMENTS: Entitlement[] = ( describe('RealtimeSettings', () => { beforeEach(() => { - vi.clearAllMocks() - mockUseAsyncCheckPermissions.mockReturnValue({ can: true, isSuccess: true }) mockUseSelectedProjectQuery.mockReturnValue({ data: { ref: 'default', connectionString: 'postgresql://example' }, diff --git a/apps/studio/components/interfaces/RedeemCredits/RedeemCredits.test.tsx b/apps/studio/components/interfaces/RedeemCredits/RedeemCredits.test.tsx index 60e47e948598c..9eb57b4ddbe5d 100644 --- a/apps/studio/components/interfaces/RedeemCredits/RedeemCredits.test.tsx +++ b/apps/studio/components/interfaces/RedeemCredits/RedeemCredits.test.tsx @@ -73,7 +73,6 @@ function renderScreen() { describe('RedeemCreditsScreen', () => { beforeEach(() => { - vi.clearAllMocks() creditRedemptionQueryCode.current = undefined routerMock.setCurrentUrl('/redeem') }) diff --git a/apps/studio/components/interfaces/Settings/Database/ConnectionPooling/ConnectionPooling.test.tsx b/apps/studio/components/interfaces/Settings/Database/ConnectionPooling/ConnectionPooling.test.tsx index 8a99bec0ec21c..48149da7a419b 100644 --- a/apps/studio/components/interfaces/Settings/Database/ConnectionPooling/ConnectionPooling.test.tsx +++ b/apps/studio/components/interfaces/Settings/Database/ConnectionPooling/ConnectionPooling.test.tsx @@ -73,8 +73,6 @@ const expectEveryQueryCall = (queryMock: ReturnType, enabled: bool describe('ConnectionPooling', () => { beforeEach(() => { - vi.clearAllMocks() - mockUseSelectedProjectQuery.mockReturnValue({ data: { id: 1, diff --git a/apps/studio/components/interfaces/Settings/Database/PoolingModesModal.test.tsx b/apps/studio/components/interfaces/Settings/Database/PoolingModesModal.test.tsx index 3258a0327b166..c4f2f5e1d1103 100644 --- a/apps/studio/components/interfaces/Settings/Database/PoolingModesModal.test.tsx +++ b/apps/studio/components/interfaces/Settings/Database/PoolingModesModal.test.tsx @@ -46,8 +46,6 @@ const expectEveryQueryCall = (queryMock: ReturnType, enabled: bool describe('PoolingModesModal', () => { beforeEach(() => { - vi.clearAllMocks() - mockUseDatabaseSettingsStateSnapshot.mockReturnValue({ showPoolingModeHelper: true, setShowPoolingModeHelper: vi.fn(), diff --git a/apps/studio/components/interfaces/Settings/Database/SSLConfiguration.test.tsx b/apps/studio/components/interfaces/Settings/Database/SSLConfiguration.test.tsx index 0d701f78f691e..9e10370d33551 100644 --- a/apps/studio/components/interfaces/Settings/Database/SSLConfiguration.test.tsx +++ b/apps/studio/components/interfaces/Settings/Database/SSLConfiguration.test.tsx @@ -87,8 +87,6 @@ function mockSSLEnforcement(config: SslEnforcementResponse) { describe('SSLConfiguration', () => { beforeEach(() => { - vi.clearAllMocks() - mockUseSelectedProjectQuery.mockReturnValue({ data: { id: 1, ref: 'default' } }) mockUseAsyncCheckPermissions.mockReturnValue({ can: true }) mockProjectSettings() diff --git a/apps/studio/components/interfaces/Settings/General/Infrastructure/RestartServerButton.test.tsx b/apps/studio/components/interfaces/Settings/General/Infrastructure/RestartServerButton.test.tsx index 940c2617184b5..9f73d09524bff 100644 --- a/apps/studio/components/interfaces/Settings/General/Infrastructure/RestartServerButton.test.tsx +++ b/apps/studio/components/interfaces/Settings/General/Infrastructure/RestartServerButton.test.tsx @@ -42,7 +42,6 @@ vi.mock('@/hooks/misc/useSelectedProject', () => ({ describe('RestartServerButton', () => { beforeEach(() => { - vi.clearAllMocks() mockUseFlag.mockReturnValue(false) mockUseAsyncCheckPermissions.mockReturnValue({ can: true }) mockUseIsFeatureEnabled.mockReturnValue({ projectSettingsRestartProject: true }) diff --git a/apps/studio/components/interfaces/Settings/General/Project.test.tsx b/apps/studio/components/interfaces/Settings/General/Project.test.tsx index f5d6803b62d33..1c2aa079dc229 100644 --- a/apps/studio/components/interfaces/Settings/General/Project.test.tsx +++ b/apps/studio/components/interfaces/Settings/General/Project.test.tsx @@ -76,8 +76,6 @@ vi.mock('@/hooks/misc/useSelectedProject', () => ({ describe('Project settings availability', () => { beforeEach(() => { - vi.clearAllMocks() - mockUseIsFeatureEnabled.mockReturnValue({ projectSettingsRestartProject: true, }) diff --git a/apps/studio/components/interfaces/Settings/General/ServiceVersions/ServiceVersionsSection.test.tsx b/apps/studio/components/interfaces/Settings/General/ServiceVersions/ServiceVersionsSection.test.tsx index 1f384ce4210c6..9debbbecc3416 100644 --- a/apps/studio/components/interfaces/Settings/General/ServiceVersions/ServiceVersionsSection.test.tsx +++ b/apps/studio/components/interfaces/Settings/General/ServiceVersions/ServiceVersionsSection.test.tsx @@ -122,7 +122,6 @@ vi.mock('@/hooks/misc/useSelectedProject', () => ({ describe('ServiceVersionsSection', () => { beforeEach(() => { - vi.clearAllMocks() mockUseFeatures.mockReturnValue({ projectAuthAll: true, projectSettingsDatabaseUpgrades: true, diff --git a/apps/studio/components/interfaces/Storage/__tests__/CreateBucketModal.test.tsx b/apps/studio/components/interfaces/Storage/__tests__/CreateBucketModal.test.tsx index dd67cccd98e4e..f7de92004a0c7 100644 --- a/apps/studio/components/interfaces/Storage/__tests__/CreateBucketModal.test.tsx +++ b/apps/studio/components/interfaces/Storage/__tests__/CreateBucketModal.test.tsx @@ -8,12 +8,13 @@ import { customRender } from '@/tests/lib/custom-render' import { addAPIMock } from '@/tests/lib/msw' import { routerMock } from '@/tests/lib/route-mock' +vi.mock(`hooks/misc/useCheckPermissions`, () => ({ + useCheckPermissions: vi.fn(), + useAsyncCheckPermissions: vi.fn().mockImplementation(() => ({ can: true })), +})) + describe(`CreateBucketModal`, () => { beforeEach(() => { - vi.mock(`hooks/misc/useCheckPermissions`, () => ({ - useCheckPermissions: vi.fn(), - useAsyncCheckPermissions: vi.fn().mockImplementation(() => ({ can: true })), - })) // useParams routerMock.setCurrentUrl(`/project/default/storage/buckets`) // useSelectedProject -> Project diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.utils.test.ts b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.utils.test.ts index 7fbe7e414641e..64a66b311c1c3 100644 --- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.utils.test.ts +++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.utils.test.ts @@ -96,11 +96,16 @@ describe('parseValue', () => { it('should return originalValue even when an error occurs', () => { const originalValue = 'some value' const format = 'some format' - // Mocking an error occurring during parsing - JSON.stringify = vi.fn(() => { + // Mocking an error occurring during parsing. Must be restored before the file + // ends: the coverage provider serializes its data with JSON.stringify. + const stringifySpy = vi.spyOn(JSON, 'stringify').mockImplementation(() => { throw new Error('Mocked error') }) - expect(parseValue(originalValue, format)).toEqual(originalValue) + try { + expect(parseValue(originalValue, format)).toEqual(originalValue) + } finally { + stringifySpy.mockRestore() + } }) }) @@ -459,9 +464,7 @@ describe('validateFields', () => { expect(validateFields(fields)).toEqual({ tags: 'Value is an invalid array' }) }) - it('should handle JSON validation (minifyJSON dependency issue)', () => { - // Note: This test shows that minifyJSON currently fails on all JSON input - // This may be due to missing dependencies in the test environment + it('should accept valid JSON', () => { const fields: RowField[] = [ createField({ name: 'data', @@ -469,8 +472,7 @@ describe('validateFields', () => { value: '{}', }), ] - // Currently all JSON fails validation in test environment - expect(validateFields(fields)).toEqual({ data: 'Value is invalid JSON' }) + expect(validateFields(fields)).toEqual({}) }) it('should return error for invalid JSON', () => { diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.utils.createTable.test.ts b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.utils.createTable.test.ts index 2f5b366797a0b..d9c87e78f03ca 100644 --- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.utils.createTable.test.ts +++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.utils.createTable.test.ts @@ -90,8 +90,6 @@ describe('createTable', () => { } beforeEach(() => { - vi.clearAllMocks() - // Default mock implementations mockExecuteSql.mockResolvedValue({ result: [] }) mockGetTable.mockResolvedValue(mockTableResult) diff --git a/apps/studio/components/layouts/APIKeys/APIKeysLayout.test.tsx b/apps/studio/components/layouts/APIKeys/APIKeysLayout.test.tsx index 9dffd1d9b6d66..b9e87b72ffe13 100644 --- a/apps/studio/components/layouts/APIKeys/APIKeysLayout.test.tsx +++ b/apps/studio/components/layouts/APIKeys/APIKeysLayout.test.tsx @@ -1,5 +1,5 @@ import { screen } from '@testing-library/react' -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import ApiKeysLayout from './APIKeysLayout' import { customRender } from '@/tests/lib/custom-render' @@ -16,10 +16,6 @@ const LEGACY_TAB = 'Legacy anon, service_role API keys' const NEW_TAB = 'Publishable and secret API keys' describe('ApiKeysLayout', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - it('hides the legacy keys tab on High Availability projects', () => { mockUseHighAvailability.mockReturnValue({ isHighAvailability: true, isPending: false }) diff --git a/apps/studio/components/layouts/AppLayout/AdvisorButton.self-hosted.test.tsx b/apps/studio/components/layouts/AppLayout/AdvisorButton.self-hosted.test.tsx index 9b575085b849d..b7b0a80a04df6 100644 --- a/apps/studio/components/layouts/AppLayout/AdvisorButton.self-hosted.test.tsx +++ b/apps/studio/components/layouts/AppLayout/AdvisorButton.self-hosted.test.tsx @@ -1,4 +1,4 @@ -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' +import { beforeEach, describe, expect, it, vi } from 'vitest' import { AdvisorButton } from '@/components/layouts/AppLayout/AdvisorButton' import { render } from '@/tests/helpers' @@ -55,10 +55,6 @@ describe('AdvisorButton on self-hosted', () => { }) }) - afterEach(() => { - vi.clearAllMocks() - }) - it('disables the notifications query so no request is made to the platform endpoint', () => { render() diff --git a/apps/studio/components/layouts/AppLayout/AdvisorButton.test.tsx b/apps/studio/components/layouts/AppLayout/AdvisorButton.test.tsx index 9f722d69f8602..c921a182b7074 100644 --- a/apps/studio/components/layouts/AppLayout/AdvisorButton.test.tsx +++ b/apps/studio/components/layouts/AppLayout/AdvisorButton.test.tsx @@ -1,5 +1,5 @@ import { screen } from '@testing-library/react' -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' +import { beforeEach, describe, expect, it, vi } from 'vitest' import { AdvisorButton } from '@/components/layouts/AppLayout/AdvisorButton' import { render } from '@/tests/helpers' @@ -56,10 +56,6 @@ describe('AdvisorButton', () => { }) }) - afterEach(() => { - vi.clearAllMocks() - }) - it('shows a warning dot when advisor signals are present', () => { mockUseAdvisorSignals.mockReturnValue({ data: [ diff --git a/apps/studio/components/layouts/AppLayout/OrganizationDropdown.test.tsx b/apps/studio/components/layouts/AppLayout/OrganizationDropdown.test.tsx index 8a052481b2fef..455cd9f5b726b 100644 --- a/apps/studio/components/layouts/AppLayout/OrganizationDropdown.test.tsx +++ b/apps/studio/components/layouts/AppLayout/OrganizationDropdown.test.tsx @@ -31,7 +31,6 @@ vi.mock('@/components/ui/PartnerIcon', () => ({ describe('OrganizationDropdown', () => { beforeEach(() => { - vi.clearAllMocks() mockUseIsFeatureEnabled.mockReturnValue(false) mockUseOrganizationsQuery.mockReturnValue({ data: [ diff --git a/apps/studio/components/layouts/AppLayout/ProjectDropdown.test.tsx b/apps/studio/components/layouts/AppLayout/ProjectDropdown.test.tsx index 8678e6e4602f5..39c862650a2f9 100644 --- a/apps/studio/components/layouts/AppLayout/ProjectDropdown.test.tsx +++ b/apps/studio/components/layouts/AppLayout/ProjectDropdown.test.tsx @@ -87,7 +87,6 @@ vi.mock('@/components/ui/PartnerIcon', () => ({ describe('ProjectDropdown', () => { beforeEach(() => { - vi.clearAllMocks() mockSelectedOrganization.mockReturnValue( createMockOrganization({ slug: 'supabase-org', diff --git a/apps/studio/components/layouts/ExplorerLayout/ExplorerLayout.constants.tsx b/apps/studio/components/layouts/ExplorerLayout/ExplorerLayout.constants.tsx index 70bdf43bf6fe3..9efa453844926 100644 --- a/apps/studio/components/layouts/ExplorerLayout/ExplorerLayout.constants.tsx +++ b/apps/studio/components/layouts/ExplorerLayout/ExplorerLayout.constants.tsx @@ -1,12 +1,9 @@ import { motion } from 'framer-motion' -import { ChevronLeft, MessageSquare, NotebookText, Plus } from 'lucide-react' +import { MessageSquare, NotebookText } from 'lucide-react' import { type ComponentType, type PropsWithChildren } from 'react' -import { Button, cn } from 'ui' +import { cn } from 'ui' import { InnerSideBarFilters, InnerSideBarFilterSearchInput } from 'ui-patterns/InnerSideMenu' -import { useCreateChat, useCreateNotebook } from '@/components/interfaces/Explorer/hooks' -import { ButtonTooltip } from '@/components/ui/ButtonTooltip' - export type ExplorerResourceType = 'notebook' | 'chat' export const LEVEL_OFFSET = 8 @@ -42,17 +39,13 @@ export const ExplorerNavResourceWrapper = ({ children, search, setSearch, - onBack, }: PropsWithChildren<{ type: ExplorerResourceType label?: string className?: string search?: string setSearch: (value: string) => void - onBack: () => void }>) => { - const { createNotebook } = useCreateNotebook() - const { createChat } = useCreateChat() const searchPlaceholder = EXPLORER_SECTIONS.find((x) => x.type === type)?.searchPlaceholder return ( @@ -65,15 +58,7 @@ export const ExplorerNavResourceWrapper = ({ transition={LEVEL_TRANSITION} className={cn('absolute inset-0 flex flex-col', className)} > -
-
)} -
+ {hasCurrentProductHeader && ( + {currentProductMenuHeader} + )} +
{viewLevel === 'top' && ( )} {viewLevel === 'section' && sectionKeyToShow && ( -
+
{sectionKeyToShow === currentSectionKey && currentProductMenu ? ( currentProductMenu ) : SectionMenuContent ? ( diff --git a/apps/studio/components/layouts/ProjectLayout/LayoutSidebar/index.test.tsx b/apps/studio/components/layouts/ProjectLayout/LayoutSidebar/index.test.tsx index 18937deb5b410..01741276e7c0e 100644 --- a/apps/studio/components/layouts/ProjectLayout/LayoutSidebar/index.test.tsx +++ b/apps/studio/components/layouts/ProjectLayout/LayoutSidebar/index.test.tsx @@ -99,7 +99,6 @@ describe('LayoutSidebar', () => { afterEach(() => { resetSidebarManagerState() localStorage.clear() - vi.clearAllMocks() }) const renderSidebar = () => diff --git a/apps/studio/components/layouts/ProjectLayout/index.test.tsx b/apps/studio/components/layouts/ProjectLayout/index.test.tsx index 13090a00efd85..45b18c908f6ff 100644 --- a/apps/studio/components/layouts/ProjectLayout/index.test.tsx +++ b/apps/studio/components/layouts/ProjectLayout/index.test.tsx @@ -1,10 +1,11 @@ -import { render, screen, waitFor } from '@testing-library/react' +import { fireEvent, render, screen, waitFor } from '@testing-library/react' import { LOCAL_STORAGE_KEYS } from 'common' -import type { ReactNode } from 'react' +import { useState, type ReactNode } from 'react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { MobileSheetProvider } from '../Navigation/NavigationBar/MobileSheetContext' +import { MobileSheetProvider, useMobileSheet } from '../Navigation/NavigationBar/MobileSheetContext' import { ProjectLayout } from './index' +import type { MobileMenuContentProps } from './LayoutHeader/MobileMenuContent' import { STUDIO_PAGE_TITLE_SEPARATOR } from '@/lib/page-title' const { mockRouter, mockSetSelectedDatabaseId, mockSetMobileMenuOpen } = vi.hoisted(() => ({ @@ -226,6 +227,67 @@ vi.mock('@/state/database-selector', () => ({ }), })) +vi.mock('./LayoutHeader/MobileMenuContent', async (importOriginal) => { + const actual = await importOriginal() + return { + ...actual, + MobileMenuContent: ({ + currentProductMenuHeader, + currentProductMenu, + }: MobileMenuContentProps) => ( +
+ {currentProductMenuHeader} + {currentProductMenu} +
+ ), + } +}) + +vi.mock('../Navigation/ProductMenuBar', () => ({ + ProductMenuBar: () => null, +})) + +const MobileSheetHarness = () => { + const { content, openMenu, setContent } = useMobileSheet() + return ( + <> + + +
{content}
+ + ) +} + +const ResourceMenuHarness = () => { + const [section, setSection] = useState('Explorer') + return ( + <> + + {section} header} + productMenu={ + + } + > +
+ + + ) +} + const renderLayout = () => render( @@ -257,10 +319,28 @@ describe('ProjectLayout title', () => { }) afterEach(() => { - vi.clearAllMocks() document.title = '' }) + it('updates the open mobile menu when resource navigation changes without replacing other sheets', () => { + render( + + + + + ) + expect(screen.getByTestId('mobile-sheet')).toBeEmptyDOMElement() + fireEvent.click(screen.getByRole('button', { name: 'Open menu' })) + expect(screen.getByText('Explorer header')).toBeInTheDocument() + fireEvent.click(screen.getByRole('button', { name: 'Open notebooks' })) + expect(screen.getByText('Notebooks header')).toBeInTheDocument() + fireEvent.click(screen.getByRole('button', { name: 'Return to Explorer' })) + expect(screen.getByText('Explorer header')).toBeInTheDocument() + fireEvent.click(screen.getByRole('button', { name: 'Open other sheet' })) + fireEvent.click(screen.getByRole('button', { name: 'Change section' })) + expect(screen.getByTestId('mobile-sheet')).toHaveTextContent('Other sheet') + }) + it('sets a composed document title and deduplicates identical section/surface labels', async () => { render( @@ -353,7 +433,6 @@ describe('FREE_MICRO_UPGRADE banner', () => { }) afterEach(() => { - vi.clearAllMocks() mockRouter.pathname = '/project/[ref]/observability/query-performance' mockRouter.asPath = '/project/default/observability/query-performance' mockProjectState.current = { diff --git a/apps/studio/components/layouts/ProjectLayout/index.tsx b/apps/studio/components/layouts/ProjectLayout/index.tsx index d03fe84dd624f..764e0f23bceff 100644 --- a/apps/studio/components/layouts/ProjectLayout/index.tsx +++ b/apps/studio/components/layouts/ProjectLayout/index.tsx @@ -6,8 +6,10 @@ import { useRouter } from 'next/router' import { forwardRef, Fragment, + isValidElement, useEffect, useLayoutEffect, + useRef, type PropsWithChildren, type ReactNode, } from 'react' @@ -107,6 +109,7 @@ export interface ProjectLayoutProps { isBlocking?: boolean product?: string productMenuBadge?: ReactNode + productMenuHeader?: ReactNode productMenu?: ReactNode browserTitle?: { entity?: string @@ -126,6 +129,7 @@ export const ProjectLayout = forwardRef { - const unregister = registerOpenMenu(() => { - setMobileSheetContent( - setMobileSheetContent(null)} - /> - ) - }) + mobileSheetContentRef.current = mobileSheetContent + }, [mobileSheetContent]) + + useLayoutEffect(() => { + const menu = ( + setMobileSheetContent(null)} + /> + ) + const unregister = registerOpenMenu(() => setMobileSheetContent(menu)) + // Keep resource navigation in an already open sheet in sync with the layout. + const currentContent = mobileSheetContentRef.current + if (isValidElement(currentContent) && currentContent.type === MobileMenuContent) { + setMobileSheetContent(menu) + } return unregister - }, [registerOpenMenu, productMenu, product, currentSectionKey, setMobileSheetContent]) + }, [ + registerOpenMenu, + productMenu, + productMenuHeader, + product, + currentSectionKey, + setMobileSheetContent, + ]) useLayoutEffect(() => { mainScrollContainer?.scrollTo({ top: 0, left: 0 }) @@ -304,6 +329,7 @@ export const ProjectLayout = forwardRef {productMenu} diff --git a/apps/studio/components/layouts/ProjectNeedsSecuring/ProjectNeedsSecuring.test.tsx b/apps/studio/components/layouts/ProjectNeedsSecuring/ProjectNeedsSecuring.test.tsx index cdd4b12567666..adca75567785c 100644 --- a/apps/studio/components/layouts/ProjectNeedsSecuring/ProjectNeedsSecuring.test.tsx +++ b/apps/studio/components/layouts/ProjectNeedsSecuring/ProjectNeedsSecuring.test.tsx @@ -170,7 +170,6 @@ describe('ProjectNeedsSecuring', () => { }) afterEach(() => { - vi.clearAllMocks() window.localStorage.clear() }) diff --git a/apps/studio/components/layouts/Tabs/ActionCard.tsx b/apps/studio/components/layouts/Tabs/ActionCard.tsx index 24f4057997b00..9586bb2599a98 100644 --- a/apps/studio/components/layouts/Tabs/ActionCard.tsx +++ b/apps/studio/components/layouts/Tabs/ActionCard.tsx @@ -1,10 +1,10 @@ import type { ReactNode } from 'react' -import { Card } from 'ui' +import { Card, cn } from 'ui' export const ActionCard = (card: { icon: ReactNode title: string - description: string + description?: string bgColor: string onClick?: () => void }) => { @@ -13,7 +13,7 @@ export const ActionCard = (card: { className="grow bg-surface-100 p-3 transition-colors hover:bg-surface-200 border hover:border-default cursor-pointer" onClick={card.onClick} > -
+
@@ -21,7 +21,7 @@ export const ActionCard = (card: {

{card.title}

-

{card.description}

+ {card.description &&

{card.description}

}
diff --git a/apps/studio/components/ui/AIAssistantPanel/AIAssistant.prompts.ts b/apps/studio/components/ui/AIAssistantPanel/AIAssistant.prompts.ts index 8274e777d8e0f..b2711d99aa89c 100644 --- a/apps/studio/components/ui/AIAssistantPanel/AIAssistant.prompts.ts +++ b/apps/studio/components/ui/AIAssistantPanel/AIAssistant.prompts.ts @@ -1,42 +1,51 @@ -export const defaultPrompts = [ - { - title: 'Create a back-end', - prompt: - 'Create a messaging app with users, messages, and an edge function that uses OpenAI to summarize message threads.', - }, - { - title: 'Health check', - prompt: 'Can you check if my database and edge functions are healthy?', - }, +import { + BookOpen, + Bug, + Database, + Gauge, + NotebookText, + ShieldCheck, + type LucideIcon, +} from 'lucide-react' + +export type ChatTemplate = { + title: string + icon: LucideIcon + initialMessage: string +} + +export const CHAT_TEMPLATES: ChatTemplate[] = [ { - title: 'Query your data', - prompt: 'Give me a list of new users from the auth.users table who signed up in the past week', + title: 'Generate sample data', + icon: Database, + initialMessage: 'Generate sample data for a blog with users, posts, and comments tables.', }, { title: 'Set up RLS policies', - prompt: 'Create RLS policies to ensure users can only access their own data', + icon: ShieldCheck, + initialMessage: 'Create RLS policies to ensure users can only access their own data.', }, { - title: 'Create a function', - prompt: 'Create an edge function that summarises the contents of a table row using OpenAI', - }, - { - title: 'Generate sample data', - prompt: 'Generate sample data for a blog with users, posts, and comments tables', + title: 'Build a notebook', + icon: NotebookText, + initialMessage: 'Build me a notebook that tracks weekly signups and active users.', }, ] export const codeSnippetPrompts = [ { title: 'Explain code', + icon: BookOpen, prompt: 'Explain what this code does and how it works', }, { title: 'Improve code', + icon: Gauge, prompt: 'How can I improve this code for better performance and readability?', }, { title: 'Debug issues', + icon: Bug, prompt: 'Help me debug any potential issues with this code', }, ] diff --git a/apps/studio/components/ui/AIAssistantPanel/AIOnboarding.tsx b/apps/studio/components/ui/AIAssistantPanel/AIOnboarding.tsx index 83df5deb1a17f..74771eb8ecbcd 100644 --- a/apps/studio/components/ui/AIAssistantPanel/AIOnboarding.tsx +++ b/apps/studio/components/ui/AIAssistantPanel/AIOnboarding.tsx @@ -1,15 +1,12 @@ -import { useParams } from 'common' -import { motion } from 'framer-motion' -import { BarChart, FileText, Shield } from 'lucide-react' -import { AiIconAnimation, Button, Skeleton } from 'ui' +import { MessageSquarePlus } from 'lucide-react' +import type { ReactNode } from 'react' -import { codeSnippetPrompts, defaultPrompts } from './AIAssistant.prompts' -import { LINTER_LEVELS } from '@/components/interfaces/Linter/Linter.constants' -import { createLintSummaryPrompt } from '@/components/interfaces/Linter/Linter.utils' -import { useProjectLintsQuery, type Lint } from '@/data/lint/lint-query' +import { CHAT_TEMPLATES, codeSnippetPrompts } from './AIAssistant.prompts' +import { ActionCard } from '@/components/layouts/Tabs/ActionCard' import type { SqlSnippet } from '@/state/ai-assistant-state' interface AIOnboardingProps { + children: ReactNode sqlSnippets?: SqlSnippet[] suggestions?: { title?: string @@ -20,161 +17,64 @@ interface AIOnboardingProps { } export const AIOnboarding = ({ + children, sqlSnippets, suggestions, onValueChange, onFocusInput, }: AIOnboardingProps) => { - const prompts = suggestions?.prompts - ? suggestions.prompts.map((suggestion) => ({ - title: suggestion.label, - prompt: suggestion.description, - icon: , - })) - : sqlSnippets && sqlSnippets.length > 0 - ? codeSnippetPrompts - : defaultPrompts + const suggestionPrompts = suggestions?.prompts ?? [] + const hasSuggestions = suggestionPrompts.length > 0 + let templates = CHAT_TEMPLATES - const { ref: projectRef } = useParams() - const { data: lints, isLoading: isLoadingLints } = useProjectLintsQuery({ projectRef }) - - const errorLints: Lint[] = (lints?.filter((lint) => lint.level === LINTER_LEVELS.ERROR) ?? - []) as Lint[] - const securityErrorLints = errorLints.filter((lint) => lint.categories?.[0] === 'SECURITY') - const performanceErrorLints = errorLints.filter((lint) => lint.categories?.[0] !== 'SECURITY') + if (hasSuggestions) { + templates = suggestionPrompts.map((suggestion) => ({ + title: suggestion.label, + icon: MessageSquarePlus, + initialMessage: suggestion.description, + })) + } else if (sqlSnippets && sqlSnippets.length > 0) { + templates = codeSnippetPrompts.map((prompt) => ({ + title: prompt.title, + icon: prompt.icon, + initialMessage: prompt.prompt, + })) + } return ( -
-
-
- - How can I assist you? - - - {suggestions?.prompts?.length ? ( -
-

Suggestions

- {prompts.map((item, index) => ( - - - - ))} -
- ) : ( - <> - {isLoadingLints ? ( -
- - {Array.from({ length: 6 }).map((_, index) => ( - - ))} -
- ) : ( - <> - {performanceErrorLints.length > 0 && ( -
-

- Improve Performance -

- {performanceErrorLints.map((lint, index) => { - return ( - - ) - })} -
- )} +
+
+
+

Chat with your project

+
- {securityErrorLints.length > 0 && ( -
-

- Improve Security -

- {securityErrorLints.map((lint, index) => { - return ( - - ) - })} -
- )} + {children} -
-

Ideas

- {prompts.map((item, index) => ( - - ))} -
- - )} - +
+ {hasSuggestions && suggestions?.title && ( +

{suggestions.title}

)} -
+
+ {templates.map((template) => ( + + ))} +
+
) diff --git a/apps/studio/components/ui/AIAssistantPanel/AssistantAgentHarnessFooter.tsx b/apps/studio/components/ui/AIAssistantPanel/AssistantAgentHarnessFooter.tsx new file mode 100644 index 0000000000000..59efa660839c8 --- /dev/null +++ b/apps/studio/components/ui/AIAssistantPanel/AssistantAgentHarnessFooter.tsx @@ -0,0 +1,30 @@ +import { useTheme } from 'next-themes' +import { parseAsBoolean, parseAsString, useQueryStates } from 'nuqs' +import { ConnectionIcon } from 'ui-patterns/McpUrlBuilder/components/ConnectionIcon' + +export const AssistantAgentHarnessFooter = () => { + const { resolvedTheme } = useTheme() + const theme = resolvedTheme === 'dark' ? 'dark' : 'light' + const [, setConnectParams] = useQueryStates({ + showConnect: parseAsBoolean.withDefault(false), + connectTab: parseAsString, + }) + + return ( +
+ +
+ ) +} diff --git a/apps/studio/components/ui/AIAssistantPanel/AssistantChat.tsx b/apps/studio/components/ui/AIAssistantPanel/AssistantChat.tsx index 20a618426843a..afd612b6c0f15 100644 --- a/apps/studio/components/ui/AIAssistantPanel/AssistantChat.tsx +++ b/apps/studio/components/ui/AIAssistantPanel/AssistantChat.tsx @@ -21,6 +21,7 @@ import { resolvePendingToolApprovalsAsDenied, } from './AIAssistant.utils' import { AIOnboarding } from './AIOnboarding' +import { AssistantAgentHarnessFooter } from './AssistantAgentHarnessFooter' import { AssistantChatForm } from './AssistantChatForm' import { Conversation, @@ -445,9 +446,95 @@ export const AssistantChat = ({ } else if (isSupportChat) { placeholder = 'Describe your support issue...' } else { - placeholder = 'Chat to Postgres...' + placeholder = 'Ask about your data, troubleshoot an issue, or explore your project...' } + const composer = ( +
+
+ {isSupportChat && !isSupportChatClosed && ( +
+
+
+ + +
+
+ )} + {disablePrompts && ( + + )} + + {isSuccess && !isApiKeySet && ( + + } + /> + )} + +
+ { + setValue(e.target.value) + onInputChange?.(e.target.value) + }} + onSubmit={(finalMessage) => { + sendMessageToAssistant(finalMessage) + }} + onStop={() => { + stop() + // to save partial responses from the AI + const lastMessage = chatMessages[chatMessages.length - 1] + if (lastMessage && lastMessage.role === 'assistant') { + state.updateMessage(lastMessage, chatId) + } + }} + sqlSnippets={composerContext?.sqlSnippets} + onRemoveSnippet={(index) => { + const newSnippets = [...(composerContext?.sqlSnippets ?? [])] + newSnippets.splice(index, 1) + composerContext?.onSetSqlSnippets?.(newSnippets) + }} + includeSnippetsInMessage={includeSnippetsInMessage} + /> +
+
+
+ ) + return ( - ) : ( - setValue(val)} - onFocusInput={() => inputRef.current?.focus()} - /> - )} + ) : null} {editingMessageId && ( @@ -600,87 +679,23 @@ export const AssistantChat = ({ )} -
-
- {isSupportChat && !isSupportChatClosed && ( -
-
-
- - -
-
- )} - {disablePrompts && ( - - )} - - {isSuccess && !isApiKeySet && ( - - } - /> - )} - - { - setValue(e.target.value) - onInputChange?.(e.target.value) - }} - onSubmit={(finalMessage) => { - sendMessageToAssistant(finalMessage) - }} - onStop={() => { - stop() - // to save partial responses from the AI - const lastMessage = chatMessages[chatMessages.length - 1] - if (lastMessage && lastMessage.role === 'assistant') { - state.updateMessage(lastMessage, chatId) - } - }} - sqlSnippets={composerContext?.sqlSnippets} - onRemoveSnippet={(index) => { - const newSnippets = [...(composerContext?.sqlSnippets ?? [])] - newSnippets.splice(index, 1) - composerContext?.onSetSqlSnippets?.(newSnippets) - }} - includeSnippetsInMessage={includeSnippetsInMessage} - /> -
-
+ {hasMessages ? ( + composer + ) : ( + { + setValue(prompt) + onInputChange?.(prompt) + }} + onFocusInput={() => inputRef.current?.focus()} + > + {composer} + {!isSupportChat && } + + )}
) diff --git a/apps/studio/components/ui/AdvisorPanel/AdvisorSignals.integration.test.tsx b/apps/studio/components/ui/AdvisorPanel/AdvisorSignals.integration.test.tsx index f8f84356d00f9..ca2ffa2c2b5a2 100644 --- a/apps/studio/components/ui/AdvisorPanel/AdvisorSignals.integration.test.tsx +++ b/apps/studio/components/ui/AdvisorPanel/AdvisorSignals.integration.test.tsx @@ -148,7 +148,6 @@ describe('Advisor signals integration', () => { advisorState.reset() sidebarManagerState.unregisterSidebar(SIDEBAR_KEYS.ADVISOR_PANEL) sidebarManagerState.clearActiveSidebar() - vi.clearAllMocks() }) it('renders signal items and dismisses them across the homepage and panel', async () => { diff --git a/apps/studio/components/ui/AdvisorPanel/useAdvisorSignals.test.tsx b/apps/studio/components/ui/AdvisorPanel/useAdvisorSignals.test.tsx index b14381b259f68..6d74fdcba999b 100644 --- a/apps/studio/components/ui/AdvisorPanel/useAdvisorSignals.test.tsx +++ b/apps/studio/components/ui/AdvisorPanel/useAdvisorSignals.test.tsx @@ -30,7 +30,6 @@ const createWrapper = () => { describe('useAdvisorSignals', () => { beforeEach(() => { window.localStorage.clear() - vi.clearAllMocks() }) it('resurfaces a dismissed banned-IP signal after the IP disappears and is banned again', async () => { diff --git a/apps/studio/components/ui/GlobalShortcuts/GlobalShortcuts.test.tsx b/apps/studio/components/ui/GlobalShortcuts/GlobalShortcuts.test.tsx index dd596214f3b04..1b6be529cee20 100644 --- a/apps/studio/components/ui/GlobalShortcuts/GlobalShortcuts.test.tsx +++ b/apps/studio/components/ui/GlobalShortcuts/GlobalShortcuts.test.tsx @@ -1,5 +1,5 @@ import { act, render, screen } from '@testing-library/react' -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { GlobalShortcuts } from './GlobalShortcuts' import { SHORTCUT_IDS } from '@/state/shortcuts/registry' @@ -24,10 +24,6 @@ vi.mock('./ShortcutsReferenceSheet', () => ({ })) describe('GlobalShortcuts', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - it('registers the shortcuts reference action in the command palette', () => { render() diff --git a/apps/studio/components/ui/PartnerManagedResource.test.tsx b/apps/studio/components/ui/PartnerManagedResource.test.tsx index 537d366e59007..f57ccea34b8bb 100644 --- a/apps/studio/components/ui/PartnerManagedResource.test.tsx +++ b/apps/studio/components/ui/PartnerManagedResource.test.tsx @@ -24,8 +24,6 @@ vi.mock('./PartnerIcon', () => ({ describe('PartnerManagedResource', () => { beforeEach(() => { - vi.clearAllMocks() - mockUseVercelRedirectQuery.mockReturnValue({ data: undefined, isLoading: false, diff --git a/apps/studio/components/ui/ProductMenu/ProductMenuShortcuts.test.tsx b/apps/studio/components/ui/ProductMenu/ProductMenuShortcuts.test.tsx index b142c33e1854d..26e2494e20375 100644 --- a/apps/studio/components/ui/ProductMenu/ProductMenuShortcuts.test.tsx +++ b/apps/studio/components/ui/ProductMenu/ProductMenuShortcuts.test.tsx @@ -1,5 +1,5 @@ import { render } from '@testing-library/react' -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import type { ProductMenuGroup } from './ProductMenu.types' import { ProductMenuShortcuts } from './ProductMenuShortcuts' @@ -54,10 +54,6 @@ const menu: ProductMenuGroup[] = [ ] describe('ProductMenuShortcuts', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - it('registers visible enabled internal shortcut items', () => { render() diff --git a/apps/studio/components/ui/Shortcut.test.tsx b/apps/studio/components/ui/Shortcut.test.tsx index 8663459425123..e6ec7a5f8a2e1 100644 --- a/apps/studio/components/ui/Shortcut.test.tsx +++ b/apps/studio/components/ui/Shortcut.test.tsx @@ -1,5 +1,5 @@ import { fireEvent, render, screen } from '@testing-library/react' -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { Shortcut } from './Shortcut' import { SHORTCUT_IDS } from '@/state/shortcuts/registry' @@ -20,10 +20,6 @@ vi.mock('./ShortcutTooltip', () => ({ })) describe('Shortcut', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - describe('rendering', () => { it('renders the wrapped child', () => { render( diff --git a/apps/studio/data/analytics/org-daily-stats-query.test.ts b/apps/studio/data/analytics/org-daily-stats-query.test.ts index b3b0e2f9ae3db..da907816ee669 100644 --- a/apps/studio/data/analytics/org-daily-stats-query.test.ts +++ b/apps/studio/data/analytics/org-daily-stats-query.test.ts @@ -1,4 +1,4 @@ -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { getOrgDailyStats } from './org-daily-stats-query' @@ -10,10 +10,6 @@ vi.mock('@/data/fetchers', () => ({ })) describe('org-daily-stats-query', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - describe('getOrgDailyStats', () => { it('throws error when orgSlug is not provided', async () => { await expect( diff --git a/apps/studio/data/handleError.test.ts b/apps/studio/data/handleError.test.ts index 40f53679f4329..12f937e59d5d1 100644 --- a/apps/studio/data/handleError.test.ts +++ b/apps/studio/data/handleError.test.ts @@ -1,4 +1,4 @@ -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { ConnectionTimeoutError, UnknownAPIResponseError } from '@/types/api-errors' import { ResponseError } from '@/types/base' @@ -21,8 +21,6 @@ function throwAndCatch(error: unknown): ResponseError { } describe('handleError — error classification', () => { - beforeEach(() => vi.clearAllMocks()) - describe('known patterns', () => { it('classifies connection timeout via message field', () => { const err = throwAndCatch({ message: 'CONNECTION TERMINATED DUE TO CONNECTION TIMEOUT' }) diff --git a/apps/studio/data/organizations/organization-mappers.test.ts b/apps/studio/data/organizations/organization-mappers.test.ts index 41aaf38be1556..3bc0f75184e34 100644 --- a/apps/studio/data/organizations/organization-mappers.test.ts +++ b/apps/studio/data/organizations/organization-mappers.test.ts @@ -1,4 +1,4 @@ -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' vi.mock('@/data/fetchers', () => ({ get: vi.fn(), @@ -47,10 +47,6 @@ const baseOrganizationSlugResponse = { } describe('organization query mappers', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - it('keeps billing_partner unchanged while deriving Stripe display state from integration_source', () => { const organization = castOrganizationResponseToOrganization({ ...baseOrganizationResponse, diff --git a/apps/studio/data/projects/project-create-mutation.test.ts b/apps/studio/data/projects/project-create-mutation.test.ts index 7b9cff6d66b23..28d893de7ee05 100644 --- a/apps/studio/data/projects/project-create-mutation.test.ts +++ b/apps/studio/data/projects/project-create-mutation.test.ts @@ -1,4 +1,4 @@ -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' vi.mock('@/data/fetchers', () => ({ post: vi.fn(), @@ -8,10 +8,6 @@ vi.mock('@/data/fetchers', () => ({ })) describe('project-create-mutation', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - describe('createProject', () => { it('sends GitHub connection fields when provided', async () => { const { post } = await import('@/data/fetchers') diff --git a/apps/studio/data/usage/org-usage-query.test.ts b/apps/studio/data/usage/org-usage-query.test.ts index 80efdaff7f410..045f7b24c73d3 100644 --- a/apps/studio/data/usage/org-usage-query.test.ts +++ b/apps/studio/data/usage/org-usage-query.test.ts @@ -1,4 +1,4 @@ -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { getOrgUsage } from './org-usage-query' @@ -10,10 +10,6 @@ vi.mock('@/data/fetchers', () => ({ })) describe('org-usage-query', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - describe('getOrgUsage', () => { it('throws error when orgSlug is not provided', async () => { await expect(getOrgUsage({ orgSlug: undefined })).rejects.toThrow('orgSlug is required') diff --git a/apps/studio/hooks/custom-content/useCustomContent.test.ts b/apps/studio/hooks/custom-content/useCustomContent.test.ts index 043488906ec5b..eb978c3190f4a 100644 --- a/apps/studio/hooks/custom-content/useCustomContent.test.ts +++ b/apps/studio/hooks/custom-content/useCustomContent.test.ts @@ -2,7 +2,6 @@ import { cleanup, renderHook } from '@testing-library/react' import { beforeEach, describe, expect, it, vi } from 'vitest' beforeEach(() => { - vi.clearAllMocks() vi.resetModules() cleanup() }) diff --git a/apps/studio/hooks/misc/__tests__/useDataApiRevokeOnCreateDefault.test.ts b/apps/studio/hooks/misc/__tests__/useDataApiRevokeOnCreateDefault.test.ts index 2d74b58dda2bd..ee275f597ef53 100644 --- a/apps/studio/hooks/misc/__tests__/useDataApiRevokeOnCreateDefault.test.ts +++ b/apps/studio/hooks/misc/__tests__/useDataApiRevokeOnCreateDefault.test.ts @@ -104,10 +104,6 @@ describe('useTrackDefaultPrivilegesExposure', () => { vi.mocked(useTrack).mockReturnValue(track) }) - afterEach(() => { - vi.clearAllMocks() - }) - it('does not fire while the flag is undefined', () => { vi.mocked(usePHFlag).mockReturnValue(undefined) renderHook(() => diff --git a/apps/studio/hooks/misc/__tests__/useTableEditorFiltersSort.test.ts b/apps/studio/hooks/misc/__tests__/useTableEditorFiltersSort.test.ts index 0361f295f33d0..f32de0395bc66 100644 --- a/apps/studio/hooks/misc/__tests__/useTableEditorFiltersSort.test.ts +++ b/apps/studio/hooks/misc/__tests__/useTableEditorFiltersSort.test.ts @@ -1,13 +1,11 @@ import { renderHook } from '@testing-library/react' import { useRouter } from 'next/router' import { withNuqsTestingAdapter } from 'nuqs/adapters/testing' -import { beforeAll, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { useTableEditorFiltersSort } from '../useTableEditorFiltersSort' -beforeAll(() => { - vi.mock('next/router', () => import('next-router-mock')) -}) +vi.mock('next/router', () => import('next-router-mock')) describe('useTableEditorFilters', () => { it('should support old syntax', async () => { diff --git a/apps/studio/lib/ai/ai-details.test.ts b/apps/studio/lib/ai/ai-details.test.ts index 343d36ea6eb32..08d8ddd35eeb0 100644 --- a/apps/studio/lib/ai/ai-details.test.ts +++ b/apps/studio/lib/ai/ai-details.test.ts @@ -45,8 +45,6 @@ describe('getAIDetails', () => { let mockCheckEntitlement: ReturnType beforeEach(async () => { - vi.clearAllMocks() - const orgsQuery = await import('@/data/organizations/organizations-query') const subscriptionQuery = await import('@/data/subscriptions/org-subscription-query') const projectQuery = await import('@/data/projects/project-detail-query') diff --git a/apps/studio/lib/ai/is-explorer-enabled.test.ts b/apps/studio/lib/ai/is-explorer-enabled.test.ts index 9a376031d80c8..b8b047d979875 100644 --- a/apps/studio/lib/ai/is-explorer-enabled.test.ts +++ b/apps/studio/lib/ai/is-explorer-enabled.test.ts @@ -15,7 +15,6 @@ vi.mock('@/lib/server/configcat', async (importOriginal) => { describe('isExplorerEnabled', () => { beforeEach(async () => { - vi.clearAllMocks() const common = await import('common') vi.spyOn(common, 'IS_PLATFORM', 'get').mockReturnValue(true) }) diff --git a/apps/studio/lib/ai/supabase-mcp.test.ts b/apps/studio/lib/ai/supabase-mcp.test.ts index eae88b4186e4c..5592b3f6012af 100644 --- a/apps/studio/lib/ai/supabase-mcp.test.ts +++ b/apps/studio/lib/ai/supabase-mcp.test.ts @@ -21,7 +21,6 @@ describe('createSupabaseMCPClient', () => { const originalSha = process.env.VERCEL_GIT_COMMIT_SHA beforeEach(() => { - vi.clearAllMocks() createMCPClientMock.mockResolvedValue({ tools: vi.fn() }) delete process.env.VERCEL_GIT_COMMIT_SHA }) diff --git a/apps/studio/lib/ai/tools/incident-tools.test.ts b/apps/studio/lib/ai/tools/incident-tools.test.ts index 056b57c0bac5b..82c27313fe1b7 100644 --- a/apps/studio/lib/ai/tools/incident-tools.test.ts +++ b/apps/studio/lib/ai/tools/incident-tools.test.ts @@ -12,7 +12,6 @@ describe('ai/tools/incident-tools', () => { let mockAbortSignal: AbortSignal beforeEach(() => { - vi.clearAllMocks() mockFetch = vi.fn() global.fetch = mockFetch as typeof fetch diff --git a/apps/studio/lib/ai/tools/index.test.ts b/apps/studio/lib/ai/tools/index.test.ts index 9fa86ca2fa764..c0157b350691f 100644 --- a/apps/studio/lib/ai/tools/index.test.ts +++ b/apps/studio/lib/ai/tools/index.test.ts @@ -25,7 +25,6 @@ const BASE_PARAMS = { describe('ai/tools getTools', () => { beforeEach(async () => { - vi.clearAllMocks() vi.mocked(getMcpTools).mockResolvedValue({ list_tables: {} } as any) // Reset to platform each test; the self-hosted test overrides to false. // Done here (not afterEach) so the spy can't leak across tests via order. diff --git a/apps/studio/lib/ai/tools/mcp-tools.test.ts b/apps/studio/lib/ai/tools/mcp-tools.test.ts index f3d03e2736e29..349c642c71a15 100644 --- a/apps/studio/lib/ai/tools/mcp-tools.test.ts +++ b/apps/studio/lib/ai/tools/mcp-tools.test.ts @@ -34,7 +34,6 @@ describe('ai/tools/mcp-tools getMcpTools', () => { let consoleErrorSpy: ReturnType beforeEach(() => { - vi.clearAllMocks() consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => {}) close = vi.fn().mockResolvedValue(undefined) tools = vi.fn().mockResolvedValue({ ...FULL_REMOTE_TOOLS }) diff --git a/apps/studio/lib/ai/tools/mock-tools.test.ts b/apps/studio/lib/ai/tools/mock-tools.test.ts index d41b7f50aeeb3..52e3f82c90aaa 100644 --- a/apps/studio/lib/ai/tools/mock-tools.test.ts +++ b/apps/studio/lib/ai/tools/mock-tools.test.ts @@ -1,4 +1,4 @@ -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' +import { beforeEach, describe, expect, it, vi } from 'vitest' import { getMockTools, MOCK_NOTEBOOKS_DATA } from './mock-tools' import { getNotebookTools } from './notebook-tools' @@ -19,7 +19,6 @@ describe('ai/tools/mock-tools getMockTools', () => { let tools: ReturnType beforeEach(() => { - vi.clearAllMocks() close = vi.fn().mockResolvedValue(undefined) tools = vi.fn().mockResolvedValue({ search_docs: SEARCH_DOCS }) vi.mocked(createInProcessSupabaseMCPClient).mockResolvedValue({ tools, close } as any) @@ -60,10 +59,6 @@ describe('ai/tools/mock-tools getMockTools', () => { expect(close).toHaveBeenCalledTimes(1) }) - afterEach(() => { - vi.clearAllMocks() - }) - describe('notebook tools', () => { const AUTH_HEALTH_NOTEBOOK_ID = MOCK_NOTEBOOKS_DATA[0].id const EDGE_FUNCTION_NOTEBOOK_ID = MOCK_NOTEBOOKS_DATA[1].id diff --git a/apps/studio/lib/api/apiAuthenticate.test.ts b/apps/studio/lib/api/apiAuthenticate.test.ts index 83fa5ecfd46f0..cb6d2107c9131 100644 --- a/apps/studio/lib/api/apiAuthenticate.test.ts +++ b/apps/studio/lib/api/apiAuthenticate.test.ts @@ -29,7 +29,6 @@ describe('apiAuthenticate', () => { const mockRes = {} as any beforeEach(() => { - vi.clearAllMocks() mocks.getUserClaims.mockResolvedValue({ claims: { sub: 'test-gotrue-id', diff --git a/apps/studio/lib/api/apiWrappers.test.ts b/apps/studio/lib/api/apiWrappers.test.ts index c089d55562def..807afc492a373 100644 --- a/apps/studio/lib/api/apiWrappers.test.ts +++ b/apps/studio/lib/api/apiWrappers.test.ts @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/nextjs' import type { JwtPayload } from '@supabase/supabase-js' import type { NextApiRequest, NextApiResponse } from 'next' -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { apiAuthenticate } from './apiAuthenticate' import { apiWrapper } from './apiWrapper' @@ -28,10 +28,6 @@ describe('apiWrapper', () => { } as unknown as NextApiResponse const mockHandler = vi.fn() - beforeEach(() => { - vi.clearAllMocks() - }) - it('should call handler directly when withAuth is false', async () => { await apiWrapper(mockReq, mockRes, mockHandler, { withAuth: false }) expect(mockHandler).toHaveBeenCalledWith(mockReq, mockRes, undefined) diff --git a/apps/studio/lib/api/generate-v4.test.ts b/apps/studio/lib/api/generate-v4.test.ts index 5fa54d62980f9..8fc0b1dd9498e 100644 --- a/apps/studio/lib/api/generate-v4.test.ts +++ b/apps/studio/lib/api/generate-v4.test.ts @@ -10,6 +10,41 @@ vi.mock('@/lib/ai/tools/tool-sanitizer', () => ({ sanitizeMessagePart: vi.fn((part) => part), })) +vi.mock('@/lib/ai/ai-details', () => ({ + getAIDetails: vi.fn().mockResolvedValue({ + aiOptInLevel: 'schema_and_log_and_data', + hasAccessToAdvanceModel: true, + hasHipaaAddon: false, + region: 'us-east-1', + isSensitive: false, + }), +})) + +vi.mock('@/lib/ai/model', () => ({ + getModel: vi.fn().mockResolvedValue({ + modelParams: { model: {} }, + systemProviderOptions: {}, + }), +})) + +vi.mock('@/data/sql/execute-sql-mutation', () => ({ + executeSql: vi.fn().mockResolvedValue({ result: [] }), +})) + +vi.mock('@/lib/ai/tools', () => ({ + getTools: vi.fn().mockResolvedValue({}), +})) + +vi.mock('ai', async () => { + const actual = await vi.importActual('ai') + return { + ...actual, + streamText: vi.fn().mockReturnValue({ + pipeUIMessageStreamToResponse: vi.fn(), + }), + } +}) + test('generateV4 calls the tool sanitizer', async () => { const mockReq = { method: 'POST', @@ -47,41 +82,6 @@ test('generateV4 calls the tool sanitizer', async () => { on: vi.fn(), } - vi.mock('@/lib/ai/ai-details', () => ({ - getAIDetails: vi.fn().mockResolvedValue({ - aiOptInLevel: 'schema_and_log_and_data', - hasAccessToAdvanceModel: true, - hasHipaaAddon: false, - region: 'us-east-1', - isSensitive: false, - }), - })) - - vi.mock('@/lib/ai/model', () => ({ - getModel: vi.fn().mockResolvedValue({ - modelParams: { model: {} }, - systemProviderOptions: {}, - }), - })) - - vi.mock('@/data/sql/execute-sql-mutation', () => ({ - executeSql: vi.fn().mockResolvedValue({ result: [] }), - })) - - vi.mock('@/lib/ai/tools', () => ({ - getTools: vi.fn().mockResolvedValue({}), - })) - - vi.mock('ai', async () => { - const actual = await vi.importActual('ai') - return { - ...actual, - streamText: vi.fn().mockReturnValue({ - pipeUIMessageStreamToResponse: vi.fn(), - }), - } - }) - await generateV4(mockReq as any, mockRes as any) expect(sanitizeMessagePart).toHaveBeenCalled() diff --git a/apps/studio/lib/api/rate.test.ts b/apps/studio/lib/api/rate.test.ts index 37347234c5dbb..03ea996886858 100644 --- a/apps/studio/lib/api/rate.test.ts +++ b/apps/studio/lib/api/rate.test.ts @@ -9,6 +9,35 @@ vi.mock('../ai/tools/tool-sanitizer', () => ({ sanitizeMessagePart: vi.fn((part) => part), })) +vi.mock('@/lib/ai/ai-details', () => ({ + getAIDetails: vi.fn().mockResolvedValue({ + aiOptInLevel: 'schema_and_log_and_data', + hasAccessToAdvanceModel: true, + hasHipaaAddon: false, + region: 'us-east-1', + isSensitive: false, + }), +})) + +vi.mock('@/lib/ai/model', () => ({ + getModel: vi.fn().mockResolvedValue({ + modelParams: { model: {} }, + }), +})) + +vi.mock('ai', () => ({ + generateText: vi.fn().mockResolvedValue({ + output: { + category: 'sql_generation', + }, + }), + Output: { object: vi.fn() }, +})) + +vi.mock('@/components/ui/AIAssistantPanel/Message.utils', () => ({ + rateMessageResponseSchema: {}, +})) + test('rate calls the tool sanitizer', async () => { const mockReq = { method: 'POST', @@ -43,35 +72,6 @@ test('rate calls the tool sanitizer', async () => { setHeader: vi.fn(() => mockRes), } - vi.mock('@/lib/ai/ai-details', () => ({ - getAIDetails: vi.fn().mockResolvedValue({ - aiOptInLevel: 'schema_and_log_and_data', - hasAccessToAdvanceModel: true, - hasHipaaAddon: false, - region: 'us-east-1', - isSensitive: false, - }), - })) - - vi.mock('@/lib/ai/model', () => ({ - getModel: vi.fn().mockResolvedValue({ - modelParams: { model: {} }, - }), - })) - - vi.mock('ai', () => ({ - generateText: vi.fn().mockResolvedValue({ - output: { - category: 'sql_generation', - }, - }), - Output: { object: vi.fn() }, - })) - - vi.mock('@/components/ui/AIAssistantPanel/Message.utils', () => ({ - rateMessageResponseSchema: {}, - })) - await rate(mockReq as any, mockRes as any) expect(sanitizeMessagePart).toHaveBeenCalled() diff --git a/apps/studio/lib/api/self-hosted/generate-types.test.ts b/apps/studio/lib/api/self-hosted/generate-types.test.ts index 5d0c70d49df10..4124e29149204 100644 --- a/apps/studio/lib/api/self-hosted/generate-types.test.ts +++ b/apps/studio/lib/api/self-hosted/generate-types.test.ts @@ -27,8 +27,6 @@ describe('api/self-hosted/generate-types', () => { let mockAssertSelfHosted: ReturnType beforeEach(async () => { - vi.clearAllMocks() - const fetchers = await import('@/data/fetchers') const util = await import('./util') diff --git a/apps/studio/lib/api/self-hosted/mcp.test.ts b/apps/studio/lib/api/self-hosted/mcp.test.ts index 940240d29730f..8491e6e51bd93 100644 --- a/apps/studio/lib/api/self-hosted/mcp.test.ts +++ b/apps/studio/lib/api/self-hosted/mcp.test.ts @@ -23,7 +23,6 @@ describe('api/self-hosted/mcp', () => { let getProjectSettingsMock: ReturnType beforeEach(async () => { - vi.clearAllMocks() vi.unstubAllEnvs() const settings = await import('./settings') getProjectSettingsMock = vi.mocked(settings.getProjectSettings) @@ -91,7 +90,6 @@ describe('api/self-hosted/mcp', () => { let retrieveAnalyticsDataMock: ReturnType beforeEach(async () => { - vi.clearAllMocks() vi.unstubAllEnvs() const logs = await import('./logs') retrieveAnalyticsDataMock = vi.mocked(logs.retrieveAnalyticsData) diff --git a/apps/studio/lib/api/self-hosted/settings.test.ts b/apps/studio/lib/api/self-hosted/settings.test.ts index f5cb08e0f5660..9a971f56cd0eb 100644 --- a/apps/studio/lib/api/self-hosted/settings.test.ts +++ b/apps/studio/lib/api/self-hosted/settings.test.ts @@ -16,7 +16,6 @@ describe('api/self-hosted/settings', () => { let mockAssertSelfHosted: ReturnType beforeEach(async () => { - vi.clearAllMocks() vi.resetModules() const util = await import('./util') diff --git a/apps/studio/lib/api/self-hosted/signing-keys.test.ts b/apps/studio/lib/api/self-hosted/signing-keys.test.ts index 8e06231cb9068..690bcd4486d2c 100644 --- a/apps/studio/lib/api/self-hosted/signing-keys.test.ts +++ b/apps/studio/lib/api/self-hosted/signing-keys.test.ts @@ -10,7 +10,6 @@ describe('api/self-hosted/signing-keys', () => { let mockAssertSelfHosted: ReturnType beforeEach(async () => { - vi.clearAllMocks() vi.resetModules() const util = await import('./util') diff --git a/apps/studio/lib/api/self-hosted/util.test.ts b/apps/studio/lib/api/self-hosted/util.test.ts index 85a041984ef55..ceba9eb71eb7c 100644 --- a/apps/studio/lib/api/self-hosted/util.test.ts +++ b/apps/studio/lib/api/self-hosted/util.test.ts @@ -21,10 +21,6 @@ vi.mock('crypto-js', () => { }) describe('api/self-hosted/util', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - describe('assertSelfHosted', () => { it('should not throw when IS_PLATFORM is false', async () => { const constants = await import('@/lib/constants') diff --git a/apps/studio/lib/api/snippets.browser.test.ts b/apps/studio/lib/api/snippets.browser.test.ts index f8223e256ca12..d66a8b4a08940 100644 --- a/apps/studio/lib/api/snippets.browser.test.ts +++ b/apps/studio/lib/api/snippets.browser.test.ts @@ -1,12 +1,8 @@ -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' +import { afterEach, describe, expect, it, vi } from 'vitest' import { generateDeterministicUuid } from './snippets.browser' describe('snippets.utils', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - afterEach(() => { vi.resetAllMocks() }) diff --git a/apps/studio/lib/api/snippets.utils.test.ts b/apps/studio/lib/api/snippets.utils.test.ts index 7cff947defc17..c2c5a2da6ad4f 100644 --- a/apps/studio/lib/api/snippets.utils.test.ts +++ b/apps/studio/lib/api/snippets.utils.test.ts @@ -1,6 +1,6 @@ import fs from 'fs/promises' import path from 'path' -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' +import { afterEach, describe, expect, it, vi } from 'vitest' import { generateDeterministicUuid } from './snippets.browser' import { @@ -40,10 +40,6 @@ vi.mock('./snippets.constants', () => ({ describe('snippets.utils', () => { const MOCK_SNIPPETS_DIR = '/mock/snippets/dir' - beforeEach(() => { - vi.clearAllMocks() - }) - afterEach(() => { vi.resetAllMocks() }) diff --git a/apps/studio/lib/error-reporting.test.ts b/apps/studio/lib/error-reporting.test.ts index b7e0f7751c8be..5f6f4ef44c397 100644 --- a/apps/studio/lib/error-reporting.test.ts +++ b/apps/studio/lib/error-reporting.test.ts @@ -1,5 +1,5 @@ import * as Sentry from '@sentry/nextjs' -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { captureCriticalError } from './error-reporting' import { ResponseError } from '@/types' @@ -13,10 +13,6 @@ vi.mock('@sentry/nextjs', () => ({ })) describe('error-reporting', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - describe('captureCriticalError', () => { it('should not capture error if message is empty', () => { const error = { message: '' } diff --git a/apps/studio/lib/helpers.test.ts b/apps/studio/lib/helpers.test.ts index 2f77b957d9716..c3cd19dff73b6 100644 --- a/apps/studio/lib/helpers.test.ts +++ b/apps/studio/lib/helpers.test.ts @@ -221,15 +221,14 @@ describe('copyToClipboard', () => { }) describe('detectBrowser', () => { - const originalNavigator = global.navigator - const setUserAgent = (ua: string) => { vi.stubGlobal('navigator', { userAgent: ua }) } afterEach(() => { + // `global.navigator` can't be assigned directly (jsdom defines it as a getter), + // so restore it by unstubbing. vi.unstubAllGlobals() - global.navigator = originalNavigator }) it('detects Chrome', () => { diff --git a/apps/studio/lib/integration-utils.test.ts b/apps/studio/lib/integration-utils.test.ts index 9f921716e91ef..070ab28e47184 100644 --- a/apps/studio/lib/integration-utils.test.ts +++ b/apps/studio/lib/integration-utils.test.ts @@ -1,4 +1,4 @@ -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { getInitialMigrationSQLFromGitHubRepo, @@ -16,10 +16,6 @@ vi.mock('@/data/fetchers', () => ({ })) describe('integration-utils', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - describe('getInitialMigrationSQLFromGitHubRepo', () => { it('should return null when no externalId is provided', async () => { const result = await getInitialMigrationSQLFromGitHubRepo() diff --git a/apps/studio/lib/navigation.test.ts b/apps/studio/lib/navigation.test.ts index 6b593ced5195d..b8f5740df6ac3 100644 --- a/apps/studio/lib/navigation.test.ts +++ b/apps/studio/lib/navigation.test.ts @@ -7,8 +7,6 @@ describe('createNavigationHandler', () => { let mockWindowOpen: any beforeEach(() => { - vi.clearAllMocks() - // Mock router with push method mockRouter = { push: vi.fn(), diff --git a/apps/studio/lib/posthog.test.ts b/apps/studio/lib/posthog.test.ts index 157ec98450c01..47b602ca63343 100644 --- a/apps/studio/lib/posthog.test.ts +++ b/apps/studio/lib/posthog.test.ts @@ -1,5 +1,5 @@ import * as common from 'common' -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import * as constants from './constants' import { trackFeatureFlag } from './posthog' @@ -18,10 +18,6 @@ vi.mock('./constants', () => ({ })) describe('trackFeatureFlag', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - it('returns undefined if user has not consented', async () => { vi.spyOn(common, 'hasConsented').mockReturnValue(false) const result = await trackFeatureFlag({ some: 'value' } as any) diff --git a/apps/studio/lib/project-supabase-client.contract.test.ts b/apps/studio/lib/project-supabase-client.contract.test.ts index 9f0ed4fcb0d03..2681769bbaa56 100644 --- a/apps/studio/lib/project-supabase-client.contract.test.ts +++ b/apps/studio/lib/project-supabase-client.contract.test.ts @@ -1,4 +1,4 @@ -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { createProjectSupabaseClient } from './project-supabase-client' import * as apiKeysUtils from '@/data/api-keys/temp-api-keys-utils' @@ -18,10 +18,6 @@ const KEY_SHAPES = [ ] describe('createProjectSupabaseClient key format contract', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - it.each(KEY_SHAPES)('constructs a client with a %s', async (_label, apiKey) => { vi.mocked(apiKeysUtils.getOrRefreshTemporaryApiKey).mockResolvedValue({ apiKey, diff --git a/apps/studio/lib/project-supabase-client.test.ts b/apps/studio/lib/project-supabase-client.test.ts index 8a50f9b5f4e35..da697c213ed83 100644 --- a/apps/studio/lib/project-supabase-client.test.ts +++ b/apps/studio/lib/project-supabase-client.test.ts @@ -1,5 +1,5 @@ import * as supabaseJs from '@supabase/supabase-js' -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { createProjectSupabaseClient } from './project-supabase-client' import * as apiKeysUtils from '@/data/api-keys/temp-api-keys-utils' @@ -13,10 +13,6 @@ vi.mock('@/data/api-keys/temp-api-keys-utils', () => ({ })) describe('project-supabase-client', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - describe('createProjectSupabaseClient', () => { it('should create a Supabase client with temporary API key', async () => { const mockApiKey = 'sb_temp_nonce1234567890ab_payload1' diff --git a/apps/studio/lib/server/configcat.test.ts b/apps/studio/lib/server/configcat.test.ts index 417c6b688c35d..027eaaec073b2 100644 --- a/apps/studio/lib/server/configcat.test.ts +++ b/apps/studio/lib/server/configcat.test.ts @@ -16,7 +16,6 @@ describe('lib/server/configcat getServerFlags', () => { } beforeEach(() => { - vi.clearAllMocks() vi.resetModules() vi.unstubAllEnvs() vi.mocked(configcat.getClient).mockReturnValue(mockClient as unknown as IConfigCatClient) diff --git a/apps/studio/lib/upload.test.ts b/apps/studio/lib/upload.test.ts index 72c4140c4f1f4..6343df4eb4530 100644 --- a/apps/studio/lib/upload.test.ts +++ b/apps/studio/lib/upload.test.ts @@ -25,7 +25,6 @@ describe('uploadAttachment', () => { const mockFile = new File(['test'], 'test.png', { type: 'image/png' }) beforeEach(() => { - vi.clearAllMocks() ;(createClient as any).mockReturnValue(mockSupabaseClient) }) diff --git a/apps/studio/package.json b/apps/studio/package.json index 269958acd384a..920028bef682a 100644 --- a/apps/studio/package.json +++ b/apps/studio/package.json @@ -172,8 +172,8 @@ "@tailwindcss/vite": "4.2.4", "@tanstack/devtools-vite": "^0.6.0", "@testing-library/dom": "^10.0.0", - "@testing-library/jest-dom": "^6.6.0", - "@testing-library/react": "^16.0.0", + "@testing-library/jest-dom": "^7.0.1", + "@testing-library/react": "^16.3.3", "@testing-library/user-event": "^14.0.0", "@types/common-tags": "^1.8.1", "@types/crypto-js": "^4.2.2", @@ -215,7 +215,6 @@ "tsx": "catalog:", "typescript": "catalog:", "vite": "catalog:", - "vite-tsconfig-paths": "catalog:", "vitest": "catalog:" } } diff --git a/apps/studio/sentry.tanstack.test.ts b/apps/studio/sentry.tanstack.test.ts index 2adb968ef6aba..c8d8e3c38f618 100644 --- a/apps/studio/sentry.tanstack.test.ts +++ b/apps/studio/sentry.tanstack.test.ts @@ -1,5 +1,5 @@ import type { AnyRouter } from '@tanstack/react-router' -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' +import { afterEach, describe, expect, it, vi } from 'vitest' const sentryMocks = vi.hoisted(() => ({ init: vi.fn(), @@ -26,10 +26,6 @@ async function loadInitializer() { } describe('initSentryTanStackClient', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - afterEach(() => { vi.unstubAllGlobals() vi.unstubAllEnvs() diff --git a/apps/studio/state/shortcuts/matchEvent.test.ts b/apps/studio/state/shortcuts/matchEvent.test.ts index 5a3f0b85a5b7b..942eb33d435e7 100644 --- a/apps/studio/state/shortcuts/matchEvent.test.ts +++ b/apps/studio/state/shortcuts/matchEvent.test.ts @@ -1,5 +1,5 @@ import { getSequenceManager } from '@tanstack/react-hotkeys' -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { eventMatchesAnyShortcut } from './matchEvent' import type { RegistryDefinations } from './types' @@ -67,10 +67,6 @@ const registry: RegistryDefinations = { } describe('eventMatchesAnyShortcut', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - it('returns false when there are no active registrations', () => { withRegistrations([]) expect(eventMatchesAnyShortcut(shiftX, registry)).toBe(false) diff --git a/apps/studio/state/shortcuts/useShortcut.test.tsx b/apps/studio/state/shortcuts/useShortcut.test.tsx index 448445b5cb2bd..5233e3d0c83f2 100644 --- a/apps/studio/state/shortcuts/useShortcut.test.tsx +++ b/apps/studio/state/shortcuts/useShortcut.test.tsx @@ -53,7 +53,6 @@ const getLastRegisterCall = () => { describe('useShortcut', () => { beforeEach(() => { - vi.clearAllMocks() mockUseIsShortcutEnabled.mockReturnValue(true) }) diff --git a/apps/studio/tests/components/Organization/TeamSettings/InviteMemberButton.network.test.tsx b/apps/studio/tests/components/Organization/TeamSettings/InviteMemberButton.network.test.tsx index a934d3ced554f..e835d9fc5b121 100644 --- a/apps/studio/tests/components/Organization/TeamSettings/InviteMemberButton.network.test.tsx +++ b/apps/studio/tests/components/Organization/TeamSettings/InviteMemberButton.network.test.tsx @@ -2,7 +2,7 @@ import { fireEvent, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' import { platformComponents as components, operations } from 'api-types' import { HttpResponse } from 'msw' -import { beforeEach, describe, expect, test, vi } from 'vitest' +import { describe, expect, test, vi } from 'vitest' import { InviteMemberButton } from '@/components/interfaces/Organization/TeamSettings/InviteMemberButton' import type { ProfileContextType } from '@/lib/profile' @@ -179,10 +179,6 @@ async function openDialog() { } describe('InviteMemberButton (network)', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - test('renders each role with its permission description and a roles docs link', async () => { setupMocks() customRender(, { profileContext: PROFILE_CONTEXT }) diff --git a/apps/studio/tests/components/Organization/TeamSettings/InviteMemberButton.test.tsx b/apps/studio/tests/components/Organization/TeamSettings/InviteMemberButton.test.tsx index 3706aeea3a4d0..43fc7198c8fb7 100644 --- a/apps/studio/tests/components/Organization/TeamSettings/InviteMemberButton.test.tsx +++ b/apps/studio/tests/components/Organization/TeamSettings/InviteMemberButton.test.tsx @@ -118,7 +118,6 @@ async function submitForm(emailValue: string) { // Tests describe('InviteMemberButton', () => { beforeEach(() => { - vi.clearAllMocks() mockInvite.mockResolvedValue({ succeeded: [], failed: [] }) }) diff --git a/apps/studio/tests/components/Organization/TeamSettings/UpdateRolesPanel.network.test.tsx b/apps/studio/tests/components/Organization/TeamSettings/UpdateRolesPanel.network.test.tsx index 0ab629a98b246..3a2b575228baf 100644 --- a/apps/studio/tests/components/Organization/TeamSettings/UpdateRolesPanel.network.test.tsx +++ b/apps/studio/tests/components/Organization/TeamSettings/UpdateRolesPanel.network.test.tsx @@ -3,7 +3,7 @@ import userEvent from '@testing-library/user-event' import { platformComponents as components } from 'api-types' import { mockAnimationsApi } from 'jsdom-testing-mocks' import { HttpResponse } from 'msw' -import { beforeEach, describe, expect, test, vi } from 'vitest' +import { describe, expect, test, vi } from 'vitest' import { UpdateRolesPanel } from '@/components/interfaces/Organization/TeamSettings/UpdateRolesPanel/UpdateRolesPanel' import type { OrganizationMember } from '@/data/organizations/organization-members-query' @@ -144,10 +144,6 @@ function setupMocks() { } describe('UpdateRolesPanel (network)', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - test('shows each role with its permission description and a roles docs link', async () => { setupMocks() customRender(, { diff --git a/apps/studio/tests/components/SQLEditor/RoleImpersonationSelector.test.tsx b/apps/studio/tests/components/SQLEditor/RoleImpersonationSelector.test.tsx index 1ccca3ca6ab78..022a3a73b97dc 100644 --- a/apps/studio/tests/components/SQLEditor/RoleImpersonationSelector.test.tsx +++ b/apps/studio/tests/components/SQLEditor/RoleImpersonationSelector.test.tsx @@ -1,7 +1,7 @@ import { screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' import { toast } from 'sonner' -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { RoleImpersonationSelectorInterface } from '@/components/interfaces/RoleImpersonationSelector' import type { ImpersonationRole } from '@/lib/role-impersonation' @@ -21,10 +21,6 @@ vi.mock('@/components/interfaces/RoleImpersonationSelector/UserImpersonationSele })) describe('RoleImpersonationSelectorInterface', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - it('enables user settings for authenticated queries and summarizes each role', async () => { const user = userEvent.setup() let currentRole: ImpersonationRole | undefined diff --git a/apps/studio/tests/components/SQLEditor/UserImpersonationSelector.test.tsx b/apps/studio/tests/components/SQLEditor/UserImpersonationSelector.test.tsx index aad89d6383c76..25213c0b075fe 100644 --- a/apps/studio/tests/components/SQLEditor/UserImpersonationSelector.test.tsx +++ b/apps/studio/tests/components/SQLEditor/UserImpersonationSelector.test.tsx @@ -43,8 +43,6 @@ const AUTH_CONFIG_WITHOUT_CUSTOM_ACCESS_TOKEN_HOOK = { describe('UserImpersonationSelector', () => { beforeEach(() => { - vi.clearAllMocks() - addAPIMock({ method: 'get', path: '/platform/projects/:ref', diff --git a/apps/studio/tests/pages/api/mcp/index.test.ts b/apps/studio/tests/pages/api/mcp/index.test.ts index d156a744cd10b..1bf7221d07a0a 100644 --- a/apps/studio/tests/pages/api/mcp/index.test.ts +++ b/apps/studio/tests/pages/api/mcp/index.test.ts @@ -29,8 +29,6 @@ describe('/api/mcp', () => { beforeEach(() => { // Disable MSW for these tests mswServer.close() - // Clear mock state between tests - vi.clearAllMocks() }) describe('Method handling', async () => { diff --git a/apps/studio/tests/pages/aws-marketplace-onboarding.test.tsx b/apps/studio/tests/pages/aws-marketplace-onboarding.test.tsx index 466f16385bb27..2765dd36958ba 100644 --- a/apps/studio/tests/pages/aws-marketplace-onboarding.test.tsx +++ b/apps/studio/tests/pages/aws-marketplace-onboarding.test.tsx @@ -122,7 +122,6 @@ function renderScreen(props: Partial { beforeEach(() => { - vi.clearAllMocks() window.localStorage.clear() }) diff --git a/apps/studio/tests/pages/cli-login.test.tsx b/apps/studio/tests/pages/cli-login.test.tsx index d66b2a453d486..a50b3e80dbbea 100644 --- a/apps/studio/tests/pages/cli-login.test.tsx +++ b/apps/studio/tests/pages/cli-login.test.tsx @@ -1,6 +1,6 @@ import { screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' -import { beforeEach, describe, expect, test, vi } from 'vitest' +import { describe, expect, test, vi } from 'vitest' import type { ProfileContextType } from '@/lib/profile' import { CliLoginScreen } from '@/pages/cli/login' @@ -53,10 +53,6 @@ function renderScreen(props: Partial[0]> = {}) } describe('CliLoginScreen', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - test('creates a session and routes to the device code', async () => { createCliLoginSessionMock.mockResolvedValue({ nonce: 'ABCDEFGH12345678' }) const { navigate } = renderScreen() diff --git a/apps/studio/tests/pages/new/[slug].test.tsx b/apps/studio/tests/pages/new/[slug].test.tsx index 46b5ddc229d77..07d3f8dcf23fe 100644 --- a/apps/studio/tests/pages/new/[slug].test.tsx +++ b/apps/studio/tests/pages/new/[slug].test.tsx @@ -341,7 +341,6 @@ const generateAndWaitForStrongPassword = async () => { describe('project creation wizard', () => { beforeEach(() => { - vi.clearAllMocks() user = userEvent.setup({ delay: null }) routerMock.setCurrentUrl(`/new/${ORG_SLUG}`) }) diff --git a/apps/studio/tests/pages/project/[ref]/settings/infrastructure.test.tsx b/apps/studio/tests/pages/project/[ref]/settings/infrastructure.test.tsx index 484e844616c8d..38abd0b404512 100644 --- a/apps/studio/tests/pages/project/[ref]/settings/infrastructure.test.tsx +++ b/apps/studio/tests/pages/project/[ref]/settings/infrastructure.test.tsx @@ -306,7 +306,6 @@ function renderInfrastructurePage() { describe('/project/[ref]/settings/infrastructure', () => { beforeEach(() => { - vi.clearAllMocks() mockInfrastructureEndpoints() window.HTMLElement.prototype.scrollIntoView = vi.fn() }) diff --git a/apps/studio/tests/pages/stripe-projects-login.test.tsx b/apps/studio/tests/pages/stripe-projects-login.test.tsx index be2c55fdf11cd..550827d7e2823 100644 --- a/apps/studio/tests/pages/stripe-projects-login.test.tsx +++ b/apps/studio/tests/pages/stripe-projects-login.test.tsx @@ -2,7 +2,7 @@ import { screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' import { HttpResponse } from 'msw' import { toast } from 'sonner' -import { beforeEach, expect, test, vi } from 'vitest' +import { expect, test, vi } from 'vitest' import { StripeProjectsLoginPage } from '@/pages/partners/stripe/projects/login' import { customRender } from '@/tests/lib/custom-render' @@ -55,10 +55,6 @@ vi.mock('@/lib/profile', () => ({ }), })) -beforeEach(() => { - vi.clearAllMocks() -}) - test('shows confirmation failures inline and keeps authorization available', async () => { const user = userEvent.setup() addAPIMock({ diff --git a/apps/studio/tests/unit/lints/mcp-advisors.test.ts b/apps/studio/tests/unit/lints/mcp-advisors.test.ts index b8fa25a56573a..486b05ee46dac 100644 --- a/apps/studio/tests/unit/lints/mcp-advisors.test.ts +++ b/apps/studio/tests/unit/lints/mcp-advisors.test.ts @@ -26,7 +26,6 @@ describe('MCP advisor operations pass exposedSchemas to getLints', () => { const headers = { Authorization: 'Bearer test' } beforeEach(() => { - vi.clearAllMocks() mockGetLints.mockResolvedValue({ data: [ { diff --git a/apps/studio/tests/vitestSetup.ts b/apps/studio/tests/vitestSetup.ts index 9465f5e8254ed..40b49a2f1f8c0 100644 --- a/apps/studio/tests/vitestSetup.ts +++ b/apps/studio/tests/vitestSetup.ts @@ -25,37 +25,38 @@ dayjs.extend(relativeTime) // }, // }) -beforeAll(() => { - mswServer.listen({ onUnhandledRequest: `error` }) - vi.mock('next/router', () => require('next-router-mock')) - vi.mock('next/navigation', async () => { - const actual = await vi.importActual('next/navigation') - return { - ...actual, - useRouter: () => { - return { - push: vi.fn(), - replace: vi.fn(), - } - }, - usePathname: () => vi.fn(), - useSearchParams: () => ({ - get: vi.fn(), - }), - } - }) +// These must stay at module scope: Vitest hoists `vi.mock` above imports. +vi.mock('next/router', () => require('next-router-mock')) +vi.mock('next/navigation', async () => { + const actual = await vi.importActual('next/navigation') + return { + ...actual, + useRouter: () => { + return { + push: vi.fn(), + replace: vi.fn(), + } + }, + usePathname: () => vi.fn(), + useSearchParams: () => ({ + get: vi.fn(), + }), + } +}) - vi.mock('next/compat/router', () => require('next-router-mock')) +vi.mock('next/compat/router', () => require('next-router-mock')) - // Mock the useParams hook from common module globally - vi.mock('common', async (importOriginal: any) => { - const actual = await importOriginal() - return { - ...(typeof actual === 'object' ? actual : {}), - useParams: () => ({ ref: 'default' }), - } - }) +// Mock the useParams hook from common module globally +vi.mock('common', async (importOriginal: any) => { + const actual = await importOriginal() + return { + ...(typeof actual === 'object' ? actual : {}), + useParams: () => ({ ref: 'default' }), + } +}) +beforeAll(() => { + mswServer.listen({ onUnhandledRequest: `error` }) routerMock.useParser(createDynamicRouteParser(['/projects/[ref]'])) }) diff --git a/apps/studio/vitest.config.ts b/apps/studio/vitest.config.ts index b0d1a68df0ff5..ec553266787ec 100644 --- a/apps/studio/vitest.config.ts +++ b/apps/studio/vitest.config.ts @@ -1,7 +1,6 @@ import { resolve } from 'node:path' import { fileURLToPath } from 'node:url' import react from '@vitejs/plugin-react' -import tsconfigPaths from 'vite-tsconfig-paths' import { configDefaults, defineConfig } from 'vitest/config' // Some tools like Vitest VSCode extensions, have trouble with resolving relative paths, @@ -12,13 +11,9 @@ const dirname = fileURLToPath(new URL('.', import.meta.url)) const IS_CI = !!process.env.CI export default defineConfig({ - plugins: [ - react(), - tsconfigPaths({ - projects: ['.'], - }), - ], + plugins: [react()], resolve: { + tsconfigPaths: true, alias: { '@ui': resolve(__dirname, './../../packages/ui/src'), }, diff --git a/apps/www/package.json b/apps/www/package.json index bdc93fa068146..67b687abfb991 100644 --- a/apps/www/package.json +++ b/apps/www/package.json @@ -126,7 +126,7 @@ "unist-util-visit": "^5.1.0", "unist-util-visit-parents": "5.1.3", "uuid": "^14.0.0", - "vite-tsconfig-paths": "catalog:", + "vite": "catalog:", "vitest": "catalog:", "zod": "catalog:" }, diff --git a/apps/www/pages/careers.tsx b/apps/www/pages/careers.tsx index b1788318a1215..5ba598e4b9330 100644 --- a/apps/www/pages/careers.tsx +++ b/apps/www/pages/careers.tsx @@ -96,7 +96,11 @@ interface CareersPageProps { contributors: { login: string; avatar_url: string; html_url: string }[] } -const CareerPage = ({ jobs, placeholderJob, contributors }: CareersPageProps) => { +const CareerPage = ({ + jobs = {}, + placeholderJob = null, + contributors = [], +}: Partial) => { const { basePath } = useRouter() const { jobsCount } = staticContent diff --git a/apps/www/vitest.config.ts b/apps/www/vitest.config.ts index 13634f4bf1887..438b33c74b133 100644 --- a/apps/www/vitest.config.ts +++ b/apps/www/vitest.config.ts @@ -1,12 +1,7 @@ -import tsconfigPaths from 'vite-tsconfig-paths' import { configDefaults, defineConfig } from 'vitest/config' export default defineConfig({ - plugins: [ - tsconfigPaths({ - projects: ['.'], - }), - ], + resolve: { tsconfigPaths: true }, test: { exclude: [...configDefaults.exclude, '.next/*'], }, diff --git a/e2e/studio/features/assistant.spec.ts b/e2e/studio/features/assistant.spec.ts index c549040e53186..d510ca77c12f8 100644 --- a/e2e/studio/features/assistant.spec.ts +++ b/e2e/studio/features/assistant.spec.ts @@ -1,4 +1,5 @@ import { expect } from '@playwright/test' + import { test } from '../utils/test.js' import { toUrl } from '../utils/to-url.js' @@ -16,10 +17,12 @@ test.describe('AI Assistant', async () => { await page.locator('#assistant-trigger').click() // Wait for the assistant panel to be visible - await expect(page.getByRole('heading', { name: 'How can I assist you?' })).toBeVisible() + await expect(page.getByRole('heading', { name: 'Chat with your project' })).toBeVisible() // Type "hello" in the chat input - const chatInput = page.getByRole('textbox', { name: 'Chat to Postgres...' }) + const chatInput = page.getByRole('textbox', { + name: 'Ask about your data, troubleshoot an issue, or explore your project...', + }) await chatInput.fill('hello') const responsePromise = page.waitForResponse( diff --git a/package.json b/package.json index aa441729e0087..e1f7d90f0d27e 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ "setup:cli": "supabase start -x studio && supabase status --output json > keys.json && node scripts/generateLocalEnv.js", "generate:types": "supabase gen types typescript --local > ./supabase/functions/common/database-types.ts", "api:codegen": "cd packages/api-types && pnpm run codegen", + "api:verify-types": "pnpm --filter=api-types run verify-production-types", "knip": "knip", "authorize-vercel-deploys": "tsx scripts/authorizeVercelDeploys.ts" }, diff --git a/packages/ai-commands/test/extensions.d.ts b/packages/ai-commands/test/extensions.d.ts index 6fcac8abd95cf..b12c924e4e45c 100644 --- a/packages/ai-commands/test/extensions.d.ts +++ b/packages/ai-commands/test/extensions.d.ts @@ -5,6 +5,6 @@ interface CustomMatchers { } declare module 'vitest' { - interface Assertion extends CustomMatchers {} - interface AsymmetricMatchersContaining extends CustomMatchers {} + // `Matchers` augments both `Assertion` and `AsymmetricMatchersContaining`. + interface Matchers extends CustomMatchers {} } diff --git a/packages/api-types/package.json b/packages/api-types/package.json index d975cab4de8c0..f230553959b1b 100644 --- a/packages/api-types/package.json +++ b/packages/api-types/package.json @@ -7,7 +7,9 @@ "scripts": { "preinstall": "npx only-allow pnpm", "clean": "rimraf .turbo tsconfig.tsbuildinfo", - "codegen": "openapi-typescript --redocly ./redocly.yaml --alphabetize --default-non-nullable=false && prettier --cache --write types/*.d.ts" + "codegen": "openapi-typescript --redocly ./redocly.yaml --alphabetize --default-non-nullable=false && prettier --cache --write types/*.d.ts", + "verify-production-types": "node ./scripts/verify-production-types.mjs", + "test": "node --test ./scripts/*.test.mjs" }, "author": "", "license": "MIT", diff --git a/packages/api-types/scripts/verify-production-types.mjs b/packages/api-types/scripts/verify-production-types.mjs new file mode 100644 index 0000000000000..308de036e7cae --- /dev/null +++ b/packages/api-types/scripts/verify-production-types.mjs @@ -0,0 +1,121 @@ +import { execFile } from 'node:child_process' +import { mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises' +import { tmpdir } from 'node:os' +import { dirname, join } from 'node:path' +import { fileURLToPath } from 'node:url' +import { promisify } from 'node:util' + +const run = promisify(execFile) +const packageDirectory = dirname(dirname(fileURLToPath(import.meta.url))) +const typesDirectory = process.env.API_TYPES_DIRECTORY ?? join(packageDirectory, 'types') +const platformApiUrl = + process.env.PLATFORM_API_OPENAPI_URL ?? 'https://api.supabase.com/api/platform-json' +const fetchTimeout = 30_000 + +const specifications = [ + { name: 'api-v1', url: 'https://api.supabase.com/api/v1-json' }, + { name: 'api-v2', url: 'https://api.supabase.com/api/v2-json' }, + { name: 'platform', url: platformApiUrl }, +] + +export async function fetchOpenApiSpecifications( + specifications, + { fetchImpl = fetch, writeFileImpl = writeFile, temporaryDirectory, generatedTypesDirectory } +) { + return Promise.all( + specifications.map(async ({ name, url }) => { + let response + + try { + response = await fetchImpl(url, { + signal: AbortSignal.timeout(fetchTimeout), + }) + } catch { + throw new Error(`Could not fetch ${name} OpenAPI specification from ${url}.`) + } + + if (!response.ok) { + throw new Error( + `Could not fetch ${name} OpenAPI specification from ${url}: ${response.status}.` + ) + } + + await writeFileImpl(join(temporaryDirectory, `${name}.json`), await response.text()) + + return ` ${name}:\n root: ${join(temporaryDirectory, `${name}.json`)}\n x-openapi-ts:\n output: ${join(generatedTypesDirectory, `${name}.d.ts`)}` + }) + ) +} + +export async function findMismatchedTypes( + specifications, + { readFileImpl = readFile, generatedTypesDirectory, typesDirectory } +) { + const mismatches = await Promise.all( + specifications.map(async ({ name }) => { + const filename = `${name}.d.ts` + const [generated, committed] = await Promise.all([ + readFileImpl(join(generatedTypesDirectory, filename), 'utf8'), + readFileImpl(join(typesDirectory, filename), 'utf8'), + ]) + + return generated === committed ? undefined : filename + }) + ) + + return mismatches.filter((filename) => filename !== undefined) +} + +export async function verifyProductionTypes() { + const temporaryDirectory = await mkdtemp(join(tmpdir(), 'api-types-')) + const generatedTypesDirectory = join(temporaryDirectory, 'types') + + try { + await mkdir(generatedTypesDirectory) + + const config = await fetchOpenApiSpecifications(specifications, { + temporaryDirectory, + generatedTypesDirectory, + }) + + await writeFile(join(temporaryDirectory, 'redocly.yaml'), `apis:\n${config.join('\n')}`) + await run( + 'pnpm', + [ + 'exec', + 'openapi-typescript', + '--redocly', + join(temporaryDirectory, 'redocly.yaml'), + '--alphabetize', + '--default-non-nullable=false', + ], + { cwd: packageDirectory } + ) + + await run( + 'pnpm', + [ + 'exec', + 'prettier', + '--write', + ...specifications.map(({ name }) => join(generatedTypesDirectory, `${name}.d.ts`)), + ], + { cwd: packageDirectory } + ) + + const changedTypes = await findMismatchedTypes(specifications, { + generatedTypesDirectory, + typesDirectory, + }) + + if (changedTypes.length > 0) { + throw new Error(`Committed API types do not match production: ${changedTypes.join(', ')}`) + } + } finally { + await rm(temporaryDirectory, { force: true, recursive: true }) + } +} + +if (process.argv[1] === fileURLToPath(import.meta.url)) { + await verifyProductionTypes() +} diff --git a/packages/api-types/scripts/verify-production-types.test.mjs b/packages/api-types/scripts/verify-production-types.test.mjs new file mode 100644 index 0000000000000..f2c67b2cecca2 --- /dev/null +++ b/packages/api-types/scripts/verify-production-types.test.mjs @@ -0,0 +1,87 @@ +import assert from 'node:assert/strict' +import test from 'node:test' + +import { fetchOpenApiSpecifications, findMismatchedTypes } from './verify-production-types.mjs' + +const specifications = [ + { name: 'api-v1', url: 'https://example.com/api/v1-json' }, + { name: 'platform', url: 'https://example.com/api/platform-json' }, +] + +test('writes fetched specifications and returns their Redocly configuration', async () => { + const writes = [] + const config = await fetchOpenApiSpecifications(specifications, { + temporaryDirectory: '/tmp/api-types', + generatedTypesDirectory: '/tmp/api-types/types', + fetchImpl: async (url) => ({ + ok: true, + text: async () => `OpenAPI specification from ${url}`, + }), + writeFileImpl: async (path, content) => writes.push({ path, content }), + }) + + assert.deepEqual(writes, [ + { + path: '/tmp/api-types/api-v1.json', + content: 'OpenAPI specification from https://example.com/api/v1-json', + }, + { + path: '/tmp/api-types/platform.json', + content: 'OpenAPI specification from https://example.com/api/platform-json', + }, + ]) + assert.deepEqual(config, [ + ' api-v1:\n root: /tmp/api-types/api-v1.json\n x-openapi-ts:\n output: /tmp/api-types/types/api-v1.d.ts', + ' platform:\n root: /tmp/api-types/platform.json\n x-openapi-ts:\n output: /tmp/api-types/types/platform.d.ts', + ]) +}) + +test('returns no mismatches when generated types match committed types', async () => { + const mismatches = await findMismatchedTypes(specifications, { + generatedTypesDirectory: '/generated', + typesDirectory: '/committed', + readFileImpl: async (path) => + path.includes('/generated/') ? 'generated type' : 'generated type', + }) + + assert.deepEqual(mismatches, []) +}) + +test('reports every generated type that differs from its committed counterpart', async () => { + const mismatches = await findMismatchedTypes(specifications, { + generatedTypesDirectory: '/generated', + typesDirectory: '/committed', + readFileImpl: async (path) => { + if (path.endsWith('api-v1.d.ts')) return 'matching type' + return path.includes('/generated/') ? 'new platform type' : 'committed platform type' + }, + }) + + assert.deepEqual(mismatches, ['platform.d.ts']) +}) + +test('rejects unsuccessful OpenAPI responses', async () => { + await assert.rejects( + fetchOpenApiSpecifications([specifications[0]], { + temporaryDirectory: '/tmp/api-types', + generatedTypesDirectory: '/tmp/api-types/types', + fetchImpl: async () => ({ ok: false, status: 503 }), + writeFileImpl: async () => assert.fail('does not write an unsuccessful response'), + }), + /Could not fetch api-v1 OpenAPI specification from https:\/\/example\.com\/api\/v1-json: 503\./ + ) +}) + +test('rejects failed OpenAPI requests', async () => { + await assert.rejects( + fetchOpenApiSpecifications([specifications[0]], { + temporaryDirectory: '/tmp/api-types', + generatedTypesDirectory: '/tmp/api-types/types', + fetchImpl: async () => { + throw new Error('network unavailable') + }, + writeFileImpl: async () => assert.fail('does not write a failed response'), + }), + /Could not fetch api-v1 OpenAPI specification from https:\/\/example\.com\/api\/v1-json\./ + ) +}) diff --git a/packages/common/configcat.test.ts b/packages/common/configcat.test.ts index bc3dacfed1eed..458d6d088c840 100644 --- a/packages/common/configcat.test.ts +++ b/packages/common/configcat.test.ts @@ -23,7 +23,6 @@ describe('configcat', () => { } beforeEach(() => { - vi.clearAllMocks() vi.resetModules() vi.unstubAllEnvs() ;(configcat.getClient as any).mockReturnValue(mockClient) diff --git a/packages/common/package.json b/packages/common/package.json index b874061734ef1..28a0b2d161527 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -37,6 +37,7 @@ "tsconfig": "workspace:*", "type-fest": "5.6.0", "typescript": "catalog:", + "vite": "catalog:", "vitest": "catalog:" }, "peerDependencies": { diff --git a/packages/dev-tools/package.json b/packages/dev-tools/package.json index 366166a2b263f..3982a1c76e090 100644 --- a/packages/dev-tools/package.json +++ b/packages/dev-tools/package.json @@ -22,8 +22,9 @@ "ui": "workspace:*" }, "devDependencies": { - "@testing-library/jest-dom": "^6.6.0", - "@testing-library/react": "^16.0.0", + "@testing-library/dom": "^10.0.0", + "@testing-library/jest-dom": "^7.0.1", + "@testing-library/react": "^16.3.3", "@testing-library/user-event": "^14.0.0", "@types/react": "catalog:", "@types/react-dom": "catalog:", @@ -33,6 +34,7 @@ "tsconfig": "workspace:*", "@typescript/native": "catalog:", "typescript": "catalog:", + "vite": "catalog:", "vitest": "catalog:", "next": "catalog:", "react": "catalog:", diff --git a/packages/ui-patterns/package.json b/packages/ui-patterns/package.json index dd40894f18c86..8cdc6963cdc1f 100644 --- a/packages/ui-patterns/package.json +++ b/packages/ui-patterns/package.json @@ -819,8 +819,8 @@ }, "devDependencies": { "@testing-library/dom": "^10.0.0", - "@testing-library/jest-dom": "^6.6.0", - "@testing-library/react": "^16.0.0", + "@testing-library/jest-dom": "^7.0.1", + "@testing-library/react": "^16.3.3", "@testing-library/user-event": "^14.0.0", "@types/common-tags": "^1.8.4", "@types/js-yaml": "^4.0.9", diff --git a/packages/ui-patterns/src/CodeBlock/CodeBlock.tsx b/packages/ui-patterns/src/CodeBlock/CodeBlock.tsx index fbd3345554e51..8d41e769e0b1d 100644 --- a/packages/ui-patterns/src/CodeBlock/CodeBlock.tsx +++ b/packages/ui-patterns/src/CodeBlock/CodeBlock.tsx @@ -269,7 +269,7 @@ export const CodeBlock = ({
diff --git a/packages/ui-patterns/src/DataInputs/Input.tsx b/packages/ui-patterns/src/DataInputs/Input.tsx index 98efedae67f78..128eb19c963fe 100644 --- a/packages/ui-patterns/src/DataInputs/Input.tsx +++ b/packages/ui-patterns/src/DataInputs/Input.tsx @@ -91,7 +91,10 @@ const Input = forwardRef< } onClick={() => _onCopy(props.value)} > diff --git a/packages/ui-patterns/src/FilterBar/FilterBar.test.tsx b/packages/ui-patterns/src/FilterBar/FilterBar.test.tsx index 9473201467608..54aecbaf39108 100644 --- a/packages/ui-patterns/src/FilterBar/FilterBar.test.tsx +++ b/packages/ui-patterns/src/FilterBar/FilterBar.test.tsx @@ -1,7 +1,7 @@ import { render, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React, { useState } from 'react' -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { FilterBar } from './FilterBar' import { FilterGroup, FilterProperty } from './types' @@ -37,10 +37,6 @@ describe('FilterBar', () => { const mockOnFilterChange = vi.fn() const mockOnFreeformTextChange = vi.fn() - beforeEach(() => { - vi.clearAllMocks() - }) - it('renders with empty state', () => { render( { } beforeEach(() => { - vi.clearAllMocks() mockRouter.asPath = '/initial' mockWindowSize.width = 400 }) diff --git a/packages/ui/package.json b/packages/ui/package.json index 676ce5ee370fa..7574072768f1c 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -43,8 +43,9 @@ }, "devDependencies": { "@hookform/resolvers": "^3.1.1", - "@testing-library/jest-dom": "^6.6.0", - "@testing-library/react": "^16.0.0", + "@testing-library/dom": "^10.0.0", + "@testing-library/jest-dom": "^7.0.1", + "@testing-library/react": "^16.3.3", "@testing-library/user-event": "^14.0.0", "@types/lodash": "4.17.5", "@types/node": "catalog:", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 12f82101721f3..c4b5fdff10a81 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -55,11 +55,11 @@ catalogs: specifier: ^6.0.1 version: 6.0.1 '@vitest/coverage-v8': - specifier: ^4.1.4 - version: 4.1.4 + specifier: ^5.0.0 + version: 5.0.0 '@vitest/ui': - specifier: ^4.1.4 - version: 4.1.4 + specifier: ^5.0.0 + version: 5.0.0 next: specifier: ^16.2.11 version: 16.2.11 @@ -96,12 +96,9 @@ catalogs: vite: specifier: ^8.0.16 version: 8.2.1 - vite-tsconfig-paths: - specifier: ^6.1.1 - version: 6.1.1 vitest: - specifier: ^4.1.4 - version: 4.1.4 + specifier: ^5.0.0 + version: 5.0.0 zod: specifier: 3.25.76 version: 3.25.76 @@ -613,8 +610,8 @@ importers: specifier: 0.3.2 version: 0.3.2 '@testing-library/react': - specifier: ^16.0.0 - version: 16.0.0(@testing-library/dom@10.4.1)(@types/react-dom@19.2.3(@types/react@19.2.14))(@types/react@19.2.14)(react-dom@19.2.6(react@19.2.6))(react@19.2.6) + specifier: ^16.3.3 + version: 16.3.3(@testing-library/dom@10.4.1)(@types/react-dom@19.2.3(@types/react@19.2.14))(@types/react@19.2.14)(react-dom@19.2.6(react@19.2.6))(react@19.2.6) '@types/common-tags': specifier: ^1.8.4 version: 1.8.4 @@ -726,12 +723,9 @@ importers: vite: specifier: 'catalog:' version: 8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0) - vite-tsconfig-paths: - specifier: 'catalog:' - version: 6.1.1(supports-color@8.1.1)(typescript@6.0.2)(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) vitest: specifier: 'catalog:' - version: 4.1.4(@opentelemetry/api@1.9.1)(@types/node@22.13.14)(@vitest/coverage-v8@4.1.4)(@vitest/ui@4.1.4)(jsdom@28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1))(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) + version: 5.0.0(@opentelemetry/api@1.9.1)(@types/node@22.13.14)(@vitest/coverage-v8@5.0.0)(@vitest/ui@5.0.0)(jsdom@28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1))(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) apps/kb: dependencies: @@ -921,9 +915,6 @@ importers: vite: specifier: ^7.3.2 version: 7.3.5(@types/node@22.13.14)(jiti@2.7.0)(lightningcss@1.33.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0) - vite-tsconfig-paths: - specifier: 'catalog:' - version: 6.1.1(supports-color@8.1.1)(typescript@6.0.2)(vite@7.3.5(@types/node@22.13.14)(jiti@2.7.0)(lightningcss@1.33.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) apps/studio: dependencies: @@ -1322,11 +1313,11 @@ importers: specifier: ^10.0.0 version: 10.4.1 '@testing-library/jest-dom': - specifier: ^6.6.0 - version: 6.6.3 + specifier: ^7.0.1 + version: 7.0.1(@testing-library/dom@10.4.1)(vitest@5.0.0) '@testing-library/react': - specifier: ^16.0.0 - version: 16.0.0(@testing-library/dom@10.4.1)(@types/react-dom@19.2.3(@types/react@19.2.14))(@types/react@19.2.14)(react-dom@19.2.6(react@19.2.6))(react@19.2.6) + specifier: ^16.3.3 + version: 16.3.3(@testing-library/dom@10.4.1)(@types/react-dom@19.2.3(@types/react@19.2.14))(@types/react@19.2.14)(react-dom@19.2.6(react@19.2.6))(react@19.2.6) '@testing-library/user-event': specifier: ^14.0.0 version: 14.6.1(@testing-library/dom@10.4.1) @@ -1383,10 +1374,10 @@ importers: version: 6.0.1(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) '@vitest/coverage-v8': specifier: 'catalog:' - version: 4.1.4(vitest@4.1.4) + version: 5.0.0(vitest@5.0.0) '@vitest/ui': specifier: 'catalog:' - version: 4.1.4(vitest@4.1.4) + version: 5.0.0(vitest@5.0.0) api-types: specifier: workspace:* version: link:../../packages/api-types @@ -1450,12 +1441,9 @@ importers: vite: specifier: 'catalog:' version: 8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0) - vite-tsconfig-paths: - specifier: 'catalog:' - version: 6.1.1(supports-color@8.1.1)(typescript@6.0.2)(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) vitest: specifier: 'catalog:' - version: 4.1.4(@opentelemetry/api@1.9.1)(@types/node@22.13.14)(@vitest/coverage-v8@4.1.4)(@vitest/ui@4.1.4)(jsdom@28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1))(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) + version: 5.0.0(@opentelemetry/api@1.9.1)(@types/node@22.13.14)(@vitest/coverage-v8@5.0.0)(@vitest/ui@5.0.0)(jsdom@28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1))(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) apps/ui-library: dependencies: @@ -2025,12 +2013,12 @@ importers: uuid: specifier: ^14.0.0 version: 14.0.0 - vite-tsconfig-paths: + vite: specifier: 'catalog:' - version: 6.1.1(supports-color@8.1.1)(typescript@6.0.2)(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) + version: 8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0) vitest: specifier: 'catalog:' - version: 4.1.4(@opentelemetry/api@1.9.1)(@types/node@22.13.14)(@vitest/coverage-v8@4.1.4)(@vitest/ui@4.1.4)(jsdom@28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1))(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) + version: 5.0.0(@opentelemetry/api@1.9.1)(@types/node@22.13.14)(@vitest/coverage-v8@5.0.0)(@vitest/ui@5.0.0)(jsdom@28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1))(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) zod: specifier: 'catalog:' version: 3.25.76 @@ -2243,7 +2231,7 @@ importers: version: 8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0) vitest: specifier: 'catalog:' - version: 4.1.4(@opentelemetry/api@1.9.1)(@types/node@22.13.14)(@vitest/coverage-v8@4.1.4)(@vitest/ui@4.1.4)(jsdom@28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1))(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) + version: 5.0.0(@opentelemetry/api@1.9.1)(@types/node@22.13.14)(@vitest/coverage-v8@5.0.0)(@vitest/ui@5.0.0)(jsdom@28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1))(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) packages/api-types: devDependencies: @@ -2340,10 +2328,10 @@ importers: version: typescript@7.0.2 '@vitest/coverage-v8': specifier: 'catalog:' - version: 4.1.4(vitest@4.1.4) + version: 5.0.0(vitest@5.0.0) '@vitest/ui': specifier: 'catalog:' - version: 4.1.4(vitest@4.1.4) + version: 5.0.0(vitest@5.0.0) lucide-react: specifier: '*' version: 0.436.0(react@19.2.6) @@ -2356,9 +2344,12 @@ importers: typescript: specifier: 'catalog:' version: 6.0.2 + vite: + specifier: 'catalog:' + version: 8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0) vitest: specifier: 'catalog:' - version: 4.1.4(@opentelemetry/api@1.9.1)(@types/node@22.13.14)(@vitest/coverage-v8@4.1.4)(@vitest/ui@4.1.4)(jsdom@28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1))(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) + version: 5.0.0(@opentelemetry/api@1.9.1)(@types/node@22.13.14)(@vitest/coverage-v8@5.0.0)(@vitest/ui@5.0.0)(jsdom@28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1))(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) packages/config: dependencies: @@ -2397,12 +2388,15 @@ importers: specifier: workspace:* version: link:../ui devDependencies: + '@testing-library/dom': + specifier: ^10.0.0 + version: 10.4.1 '@testing-library/jest-dom': - specifier: ^6.6.0 - version: 6.6.3 + specifier: ^7.0.1 + version: 7.0.1(@testing-library/dom@10.4.1)(vitest@5.0.0) '@testing-library/react': - specifier: ^16.0.0 - version: 16.0.0(@testing-library/dom@10.4.1)(@types/react-dom@19.2.3(@types/react@19.2.14))(@types/react@19.2.14)(react-dom@19.2.6(react@19.2.6))(react@19.2.6) + specifier: ^16.3.3 + version: 16.3.3(@testing-library/dom@10.4.1)(@types/react-dom@19.2.3(@types/react@19.2.14))(@types/react@19.2.14)(react-dom@19.2.6(react@19.2.6))(react@19.2.6) '@testing-library/user-event': specifier: ^14.0.0 version: 14.6.1(@testing-library/dom@10.4.1) @@ -2439,9 +2433,12 @@ importers: typescript: specifier: 'catalog:' version: 6.0.2 + vite: + specifier: 'catalog:' + version: 8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0) vitest: specifier: 'catalog:' - version: 4.1.4(@opentelemetry/api@1.9.1)(@types/node@22.13.14)(@vitest/coverage-v8@4.1.4)(@vitest/ui@4.1.4)(jsdom@28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1))(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) + version: 5.0.0(@opentelemetry/api@1.9.1)(@types/node@22.13.14)(@vitest/coverage-v8@5.0.0)(@vitest/ui@5.0.0)(jsdom@28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1))(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) packages/eslint-config-supabase: devDependencies: @@ -2564,7 +2561,7 @@ importers: version: typescript@7.0.2 '@vitest/coverage-v8': specifier: 'catalog:' - version: 4.1.4(vitest@4.1.4) + version: 5.0.0(vitest@5.0.0) npm-run-all: specifier: ^4.1.5 version: 4.1.5 @@ -2582,7 +2579,7 @@ importers: version: 8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0) vitest: specifier: 'catalog:' - version: 4.1.4(@opentelemetry/api@1.9.1)(@types/node@22.13.14)(@vitest/coverage-v8@4.1.4)(@vitest/ui@4.1.4)(jsdom@28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1))(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) + version: 5.0.0(@opentelemetry/api@1.9.1)(@types/node@22.13.14)(@vitest/coverage-v8@5.0.0)(@vitest/ui@5.0.0)(jsdom@28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1))(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) packages/shared-data: dependencies: @@ -2680,12 +2677,15 @@ importers: '@hookform/resolvers': specifier: ^3.1.1 version: 3.3.1(react-hook-form@7.72.1(react@19.2.6)) + '@testing-library/dom': + specifier: ^10.0.0 + version: 10.4.1 '@testing-library/jest-dom': - specifier: ^6.6.0 - version: 6.6.3 + specifier: ^7.0.1 + version: 7.0.1(@testing-library/dom@10.4.1)(vitest@5.0.0) '@testing-library/react': - specifier: ^16.0.0 - version: 16.0.0(@testing-library/dom@10.4.1)(@types/react-dom@19.2.3(@types/react@19.2.14))(@types/react@19.2.14)(react-dom@19.2.6(react@19.2.6))(react@19.2.6) + specifier: ^16.3.3 + version: 16.3.3(@testing-library/dom@10.4.1)(@types/react-dom@19.2.3(@types/react@19.2.14))(@types/react@19.2.14)(react-dom@19.2.6(react@19.2.6))(react@19.2.6) '@testing-library/user-event': specifier: ^14.0.0 version: 14.6.1(@testing-library/dom@10.4.1) @@ -2709,7 +2709,7 @@ importers: version: typescript@7.0.2 '@vitest/coverage-v8': specifier: 'catalog:' - version: 4.1.4(vitest@4.1.4) + version: 5.0.0(vitest@5.0.0) config: specifier: workspace:* version: link:../config @@ -2727,7 +2727,7 @@ importers: version: 8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0) vitest: specifier: 'catalog:' - version: 4.1.4(@opentelemetry/api@1.9.1)(@types/node@22.13.14)(@vitest/coverage-v8@4.1.4)(@vitest/ui@4.1.4)(jsdom@28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1))(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) + version: 5.0.0(@opentelemetry/api@1.9.1)(@types/node@22.13.14)(@vitest/coverage-v8@5.0.0)(@vitest/ui@5.0.0)(jsdom@28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1))(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) packages/ui-patterns: dependencies: @@ -2883,11 +2883,11 @@ importers: specifier: ^10.0.0 version: 10.4.1 '@testing-library/jest-dom': - specifier: ^6.6.0 - version: 6.6.3 + specifier: ^7.0.1 + version: 7.0.1(@testing-library/dom@10.4.1)(vitest@5.0.0) '@testing-library/react': - specifier: ^16.0.0 - version: 16.0.0(@testing-library/dom@10.4.1)(@types/react-dom@19.2.3(@types/react@19.2.14))(@types/react@19.2.14)(react-dom@19.2.6(react@19.2.6))(react@19.2.6) + specifier: ^16.3.3 + version: 16.3.3(@testing-library/dom@10.4.1)(@types/react-dom@19.2.3(@types/react@19.2.14))(@types/react@19.2.14)(react-dom@19.2.6(react@19.2.6))(react@19.2.6) '@testing-library/user-event': specifier: ^14.0.0 version: 14.6.1(@testing-library/dom@10.4.1) @@ -2920,7 +2920,7 @@ importers: version: typescript@7.0.2 '@vitest/coverage-v8': specifier: 'catalog:' - version: 4.1.4(vitest@4.1.4) + version: 5.0.0(vitest@5.0.0) api-types: specifier: workspace:* version: link:../api-types @@ -2950,7 +2950,7 @@ importers: version: 8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0) vitest: specifier: 'catalog:' - version: 4.1.4(@opentelemetry/api@1.9.1)(@types/node@22.13.14)(@vitest/coverage-v8@4.1.4)(@vitest/ui@4.1.4)(jsdom@28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1))(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) + version: 5.0.0(@opentelemetry/api@1.9.1)(@types/node@22.13.14)(@vitest/coverage-v8@5.0.0)(@vitest/ui@5.0.0)(jsdom@28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1))(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) packages: @@ -8539,19 +8539,25 @@ packages: resolution: {integrity: sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg==} engines: {node: '>=18'} - '@testing-library/jest-dom@6.6.3': - resolution: {integrity: sha512-IteBhl4XqYNkM54f4ejhLRJiZNqcSCoXUOG2CPK7qbD322KjQozM4kHQOfkG2oln9b9HTYqs+Sae8vBATubxxA==} - engines: {node: '>=14', npm: '>=6', yarn: '>=1'} + '@testing-library/jest-dom@7.0.1': + resolution: {integrity: sha512-oMDTC3oA+6CXSO2JZnvOI7CA6oVub6kij5ggk9ohwye5slmkwxYDXcPOVxgMw/RQlticjtO0C1RZkR97HgrWMw==} + engines: {node: '>=22', npm: '>=6', yarn: '>=1'} + peerDependencies: + '@testing-library/dom': '>=10 <11' + vitest: '>= 0.32' + peerDependenciesMeta: + vitest: + optional: true - '@testing-library/react@16.0.0': - resolution: {integrity: sha512-guuxUKRWQ+FgNX0h0NS0FIq3Q3uLtWVpBzcLOggmfMoUpgBnzBzvLLd4fbm6yS8ydJd94cIfY4yP9qUQjM2KwQ==} + '@testing-library/react@16.3.3': + resolution: {integrity: sha512-Uo193NgQbPMz6lrrhtRQQFcMC6Re/ELLFbbuVL30WDlZxlpZf9/lMHTAVxPRLw1q1iu9OJmR1c2BLiENRstdBg==} engines: {node: '>=18'} peerDependencies: '@testing-library/dom': ^10.0.0 - '@types/react': ^18.0.0 - '@types/react-dom': ^18.0.0 - react: ^18.0.0 - react-dom: ^18.0.0 + '@types/react': ^18.0.0 || ^19.0.0 + '@types/react-dom': ^18.0.0 || ^19.0.0 + react: ^18.0.0 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 peerDependenciesMeta: '@types/react': optional: true @@ -9325,20 +9331,25 @@ packages: vite: ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 vue: ^3.2.25 - '@vitest/coverage-v8@4.1.4': - resolution: {integrity: sha512-x7FptB5oDruxNPDNY2+S8tCh0pcq7ymCe1gTHcsp733jYjrJl8V1gMUlVysuCD9Kz46Xz9t1akkv08dPcYDs1w==} + '@vitest/coverage-v8@5.0.0': + resolution: {integrity: sha512-toMg6PZGCIa/lQNCDoASrfb1ly4hsUKXFtFYC9kD4t78o5Y6LyNJU7AENt8eHPr3quYdxaxK7hj2mnbFfUk9NA==} peerDependencies: - '@vitest/browser': 4.1.4 - vitest: 4.1.4 + '@vitest/browser': 5.0.0 + vitest: 5.0.0 peerDependenciesMeta: '@vitest/browser': optional: true - '@vitest/expect@4.1.4': - resolution: {integrity: sha512-iPBpra+VDuXmBFI3FMKHSFXp3Gx5HfmSCE8X67Dn+bwephCnQCaB7qWK2ldHa+8ncN8hJU8VTMcxjPpyMkUjww==} + '@vitest/istanbul-lib-coverage@1.0.1': + resolution: {integrity: sha512-k3DJZ8LhMBK9NS4SclF1ASD3OgXEWDorbIcPTRDK0/Zae6fRvu+fJRxtFdLfHsa9Y24beCdPnoNZ4LviTNstfA==} + engines: {node: '>=22'} - '@vitest/mocker@4.1.4': - resolution: {integrity: sha512-R9HTZBhW6yCSGbGQnDnH3QHfJxokKN4KB+Yvk9Q1le7eQNYwiCyKxmLmurSpFy6BzJanSLuEUDrD+j97Q+ZLPg==} + '@vitest/istanbul-lib-report@1.0.1': + resolution: {integrity: sha512-1EOLRfsTMnyAr3+kEAsP4o9dhaDlGPpD7H5iLBBeq//YpNB1VIahkPhB+eRp9N2Dkfw8oySROjE3yf9XDeaIkQ==} + engines: {node: '>=22'} + + '@vitest/mocker@5.0.0': + resolution: {integrity: sha512-66PGTMIiVJP3t4a5yxU9qPtf7MdTBs8jmToMvy+HVflB3Yy13WJZTtPePdvU+wjRV02SKK5doLbSA6o9pwOmiA==} peerDependencies: msw: ^2.4.9 vite: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -9348,25 +9359,19 @@ packages: vite: optional: true - '@vitest/pretty-format@4.1.4': - resolution: {integrity: sha512-ddmDHU0gjEUyEVLxtZa7xamrpIefdEETu3nZjWtHeZX4QxqJ7tRxSteHVXJOcr8jhiLoGAhkK4WJ3WqBpjx42A==} - - '@vitest/runner@4.1.4': - resolution: {integrity: sha512-xTp7VZ5aXP5ZJrn15UtJUWlx6qXLnGtF6jNxHepdPHpMfz/aVPx+htHtgcAL2mDXJgKhpoo2e9/hVJsIeFbytQ==} - - '@vitest/snapshot@4.1.4': - resolution: {integrity: sha512-MCjCFgaS8aZz+m5nTcEcgk/xhWv0rEH4Yl53PPlMXOZ1/Ka2VcZU6CJ+MgYCZbcJvzGhQRjVrGQNZqkGPttIKw==} + '@vitest/pretty-format@5.0.0': + resolution: {integrity: sha512-PVRNuB3wpReb4SQEs4zTKM4KWFhQ5pw3spE8naoDJNB5T5aWRzGKHwXcLUllr0WeOTXpB6bSr3CJLo5+7XQSSQ==} - '@vitest/spy@4.1.4': - resolution: {integrity: sha512-XxNdAsKW7C+FLydqFJLb5KhJtl3PGCMmYwFRfhvIgxJvLSXhhVI1zM8f1qD3Zg7RCjTSzDVyct6sghs9UEgBEQ==} + '@vitest/spy@5.0.0': + resolution: {integrity: sha512-uy+luWBAPw9XfthoHi5AkfHUnuPYEESjl0p/r+meoBnU8bxg5GDQ3Ey8MjcJ6sqahkL4PFyrvfMJJBw7LbU06g==} - '@vitest/ui@4.1.4': - resolution: {integrity: sha512-EgFR7nlj5iTDYZYCvavjFokNYwr3c3ry0sFiCg+N7B233Nwp+NNx7eoF/XvMWDCKY71xXAG3kFkt97ZHBJVL8A==} + '@vitest/ui@5.0.0': + resolution: {integrity: sha512-h2FIFwggCY2GxUd2UdQoYNVQkOIqEQLPhNREcl3FUiRsdzQep7NWwYbSmhGEA9nFLPDq5pXzRMcBZQU8Py83sg==} peerDependencies: - vitest: 4.1.4 + vitest: 5.0.0 - '@vitest/utils@4.1.4': - resolution: {integrity: sha512-13QMT+eysM5uVGa1rG4kegGYNp6cnQcsTc67ELFbhNLQO+vgsygtYJx2khvdt4gVQqSSpC/KT5FZZxUpP3Oatw==} + '@vitest/utils@5.0.0': + resolution: {integrity: sha512-dO++xL3vDfvhTAVimfkuQUA3k+JClIF1i1vAkPqpcGAthRmeWnXmHB7YPViPvgCwviX8u7Y5W1u2N//AaQr3fw==} '@vue-macros/common@3.1.4': resolution: {integrity: sha512-/5Fv+6DgIcM9ajY05ZmKBv+LMX1M9A0X+IUwDRVdt67ciw8OV9bvG2r34p3RiEadlsQybjhKPRKNXDC8Bp23cw==} @@ -9866,8 +9871,8 @@ packages: resolution: {integrity: sha512-6t10qk83GOG8p0vKmaCr8eiilZwO171AvbROMtvvNiwrTly62t+7XkA8RdIIVbpMhCASAsxgAzdRSwh6nw/5Dg==} engines: {node: '>=4'} - ast-v8-to-istanbul@1.0.0: - resolution: {integrity: sha512-1fSfIwuDICFA4LKkCzRPO7F0hzFf0B7+Xqrl27ynQaa+Rh0e1Es0v6kWHPott3lU10AyAr7oKHa65OppjLn3Rg==} + ast-v8-to-istanbul@1.0.5: + resolution: {integrity: sha512-UPAgKJFSEGMWSDr3LX4tqnAb4f7KGT8O40Tyx8wbYmmZ/yn58lNCm8h3svs3eXgiGd5AXxz8NDOvXWvicq+rJA==} ast-walker-scope@0.9.0: resolution: {integrity: sha512-IJdzo2vLiElBxKzwS36VsCue/62d6IdWjnPB2v3nuPKeWGynp6FF/CYoLa5i/3jXH/z97ZDdsXz6abpgM6w07A==} @@ -10180,10 +10185,6 @@ packages: resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} engines: {node: '>=4'} - chalk@3.0.0: - resolution: {integrity: sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==} - engines: {node: '>=8'} - chalk@4.1.2: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} engines: {node: '>=10'} @@ -11348,6 +11349,9 @@ packages: es-module-lexer@2.1.0: resolution: {integrity: sha512-n27zTYMjYu1aj4MjCWzSP7G9r75utsaoc8m61weK+W8JMBGGQybd43GstCXZ3WNmSFtGT9wi59qQTW6mhTR5LQ==} + es-module-lexer@2.3.2: + resolution: {integrity: sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==} + es-object-atoms@1.1.1: resolution: {integrity: sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==} engines: {node: '>= 0.4'} @@ -11783,8 +11787,8 @@ packages: resolution: {integrity: sha512-AFASGfIlnIbkKPQwX1yHaDjFvh/1gyKJODme52V6IORh69uEYgZp0o9C+qsIGNVEiuuhQU0CSSl++Rlegg1qvA==} engines: {node: '>=0.10.0'} - expect-type@1.3.0: - resolution: {integrity: sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA==} + expect-type@1.4.0: + resolution: {integrity: sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==} engines: {node: '>=12.0.0'} exponential-backoff@3.1.1: @@ -11934,6 +11938,9 @@ packages: fflate@0.8.2: resolution: {integrity: sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==} + fflate@0.8.3: + resolution: {integrity: sha512-tbZNuJrLwGUp3zshBtdy4W+ORxZuIh8a5ilyIEQDC5rY1f3U20JMry0Ll3WBzU58EZKsEuJFXhb5gwv8CsPvgA==} + fft.js@4.0.4: resolution: {integrity: sha512-f9c00hphOgeQTlDyavwTtu6RiK8AIFjD6+jvXkNkpeQ7rirK3uFWVpalkoS4LAwbdX7mfZ8aoBfFVQX1Re/8aw==} @@ -12013,6 +12020,9 @@ packages: flatted@3.4.2: resolution: {integrity: sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==} + flatted@3.4.4: + resolution: {integrity: sha512-5+ybhBZANEJxaH3X5evAFatUxLfEHSr7n6kYJ+1Qd0mUqr4eu9gIf6GDbWHf8RJijHrjjO8G+la14SlL2SeS1Q==} + flattie@1.1.1: resolution: {integrity: sha512-9UbaD6XdAL97+k/n+N7JwX46K/M6Zc6KcFYskrYL8wbBV/Uyk0CTAMY0VT+qiK5PM7AIc9aTWYtq65U7T+aCNQ==} engines: {node: '>=8'} @@ -12332,9 +12342,6 @@ packages: resolution: {integrity: sha512-QrJia2qDf5BB/V6HYlDTs0I0lBahyjLzpGQg3KT7FnCdTonAyPy2RtY802m2k4ALx6Dp752f82WsOczEVr3l6Q==} engines: {node: '>=20'} - globrex@0.1.2: - resolution: {integrity: sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==} - goober@2.1.19: resolution: {integrity: sha512-U7veizMqxyKlM58+Z5j2ngJBH/r9siDmxpvNxSw0PylF6WQvrASJEZrxh1hidRBJc2jqoBVSyOban5u8m+6Rxg==} peerDependencies: @@ -13189,18 +13196,6 @@ packages: isomorphic.js@0.2.5: resolution: {integrity: sha512-PIeMbHqMt4DnUP3MA/Flc0HElYjMXArsw1qwJZcm9sqR8mq3l8NYizFMty0pWwE/tzIGH3EKK5+jes5mAr85yw==} - istanbul-lib-coverage@3.2.2: - resolution: {integrity: sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==} - engines: {node: '>=8'} - - istanbul-lib-report@3.0.1: - resolution: {integrity: sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==} - engines: {node: '>=10'} - - istanbul-reports@3.2.0: - resolution: {integrity: sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA==} - engines: {node: '>=8'} - iterator.prototype@1.1.5: resolution: {integrity: sha512-H0dkQoCa3b2VEeKQBOxFph+JAbcrQdE7KC0UkqwpLmv2EC4P41QXP+rqo9wYodACiG5/WM5s9oDApTU8utwj9g==} engines: {node: '>= 0.4'} @@ -13800,6 +13795,9 @@ packages: magic-string@1.1.0: resolution: {integrity: sha512-kS3VHe0nEPST2saQV4Rbkchcd3UBRkVTQHo1D3h/ZTwFDhai/mfKkmtPAtD129EOI7K3HlHIsFOt0WrI2/oU9g==} + magic-string@1.2.3: + resolution: {integrity: sha512-Bpb0W2TbLKOZ7vJnOUnVRGq3WL2p+ISV29M6hYPL1AFCpyKZpdr5ytiXoTSSxRVhg8YW7f65+6gbG8WG6PCa/g==} + magicast@0.5.4: resolution: {integrity: sha512-llBEhWm1SacoRwgHUoQJYtwp4PBLF4faQi5TCpIGyGs9n4y5+juI0tDgyKIfpqxckRHaHzouUEph3THklWh03w==} @@ -13807,10 +13805,6 @@ packages: resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==} engines: {node: '>=8'} - make-dir@4.0.0: - resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==} - engines: {node: '>=10'} - make-fetch-happen@13.0.1: resolution: {integrity: sha512-cKTUFc/rbKUd/9meOvgrpJ2WrNzymt6jfRDdwg5UCnVzv9dTpEj9JS5m3wtziXVCjluIXyL8pcaukYqezIzZQA==} engines: {node: ^16.14.0 || >=18.0.0} @@ -14855,6 +14849,10 @@ packages: obug@2.1.1: resolution: {integrity: sha512-uTqF9MuPraAQ+IsnPf366RG4cP9RtUi7MLO1N3KEc+wb0a6yKpeL0lmk2IB1jY5KHPAlTc6T/JRdC/YqxHNwkQ==} + obug@2.1.4: + resolution: {integrity: sha512-4a+OsYv9UktOJKE+l1A4OufDgdRF9PifWj+tJnHURo/P+WOxpG4GzUFL9qCalmWauao6ogiG+QvnCovwPoyAWA==} + engines: {node: '>=12.20.0'} + ofetch@1.5.1: resolution: {integrity: sha512-2W4oUZlVaqAPAil6FUg/difl6YhqhUR7x2eZY4bQCko22UXg3hptq9KLQdqFClV+Wu85UX7hNtdGTngi/1BxcA==} @@ -15276,6 +15274,10 @@ packages: resolution: {integrity: sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==} engines: {node: '>=12'} + picomatch@4.0.7: + resolution: {integrity: sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==} + engines: {node: '>=12'} + pidtree@0.3.1: resolution: {integrity: sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA==} engines: {node: '>=0.10'} @@ -17097,8 +17099,9 @@ packages: tiny-invariant@1.3.3: resolution: {integrity: sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==} - tinybench@2.9.0: - resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} + tinybench@6.1.4: + resolution: {integrity: sha512-9APumHG7r4yOk4X4WlkmE71aZcv1gvin1czO3OQ1U9iJcFA5Ja/ygyb0vPOVHTthFozUYs8CLoLUlM8grb2lTQ==} + engines: {node: '>=20.0.0'} tinyclip@0.1.15: resolution: {integrity: sha512-uo33abH+Ays0xYaDysoBt494Hb3hsEczMpcC0MwFl773pazORx4fmvKhclhR1wonUbB6vvpRsvVMwnhfqeMc+A==} @@ -17108,6 +17111,10 @@ packages: resolution: {integrity: sha512-SHf/r48b7vOrjve9PxJo3MN5v5yuyjHvdUcrQffT3WXMUfnGmHDVbC4k3sHJaJTgZCwpUplIaAo5ANtMyp3YHg==} engines: {node: '>=18'} + tinyexec@1.3.0: + resolution: {integrity: sha512-QKAl9m8gWWGHV8jZcPeym6j+XULi6tOf1mT83WYJ4Lk2ytW/uwAWkrP0uFsdoYMdueVJ0qs26wZ+23xeB4ibNQ==} + engines: {node: '>=18'} + tinyglobby@0.2.15: resolution: {integrity: sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==} engines: {node: '>=12.0.0'} @@ -17120,8 +17127,8 @@ packages: resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==} engines: {node: '>=12.0.0'} - tinyrainbow@3.1.0: - resolution: {integrity: sha512-Bf+ILmBgretUrdJxzXM0SgXLZ3XfiaUuOj/IKQHuTXip+05Xn+uyEYdVg0kYDipTBcLrCVyUzAPz7QmArb0mmw==} + tinyrainbow@3.1.1: + resolution: {integrity: sha512-yau8yJdTt989Mm0Bd/236QnzEiPf2xLLTqUZRUJOo/3CB078LSwzei343DgtJVmfJKJE3TMINY1u42SQsP6mXw==} engines: {node: '>=14.0.0'} title-case@3.0.3: @@ -17219,17 +17226,6 @@ packages: ts-morph@26.0.0: resolution: {integrity: sha512-ztMO++owQnz8c/gIENcM9XfCEzgoGphTv+nKpYNM1bgsdOVC/jRZuEBf6N+mLLDNg68Kl+GgUZfOySaRiG1/Ug==} - tsconfck@3.0.3: - resolution: {integrity: sha512-4t0noZX9t6GcPTfBAbIbbIU4pfpCwh0ueq3S4O/5qXI1VwK1outmxhe9dOiEWqMz3MW2LKgDTpqWV+37IWuVbA==} - engines: {node: ^18 || >=20} - deprecated: unmaintained - hasBin: true - peerDependencies: - typescript: ^5.0.0 - peerDependenciesMeta: - typescript: - optional: true - tsconfig-paths@3.15.0: resolution: {integrity: sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==} @@ -17919,11 +17915,6 @@ packages: vite: ^6.0.0 || ^7.0.0 || ^8.0.0-0 vue: ^3.5.0 - vite-tsconfig-paths@6.1.1: - resolution: {integrity: sha512-2cihq7zliibCCZ8P9cKJrQBkfgdvcFkOOc3Y02o3GWUDLgqjWsZudaoiuOwO/gzTzy17cS5F7ZPo4bsnS4DGkg==} - peerDependencies: - vite: '*' - vite@7.3.5: resolution: {integrity: sha512-KuOaNhcnGFN2zIPGA7wRmzF+lJA1sea7rHq17aiJ++9lzY1WWG6Jpwqwe1KNbRVPIqHmr8GLYx7jbrQcN/7/ww==} engines: {node: ^20.19.0 || >=22.12.0} @@ -18015,23 +18006,23 @@ packages: vite: optional: true - vitest@4.1.4: - resolution: {integrity: sha512-tFuJqTxKb8AvfyqMfnavXdzfy3h3sWZRWwfluGbkeR7n0HUev+FmNgZ8SDrRBTVrVCjgH5cA21qGbCffMNtWvg==} - engines: {node: ^20.0.0 || ^22.0.0 || >=24.0.0} + vitest@5.0.0: + resolution: {integrity: sha512-gpsMNoRhMjMktVxPtstOH4/PJuPyovVaMDr4oDilXaGH1EcqM2OE96SoHT2VIQ6fTGtTjqmHDrEu2X9RQiXf8Q==} + engines: {node: ^22.12.0 || ^24.0.0 || >=26.0.0} hasBin: true peerDependencies: '@edge-runtime/vm': '*' '@opentelemetry/api': ^1.9.0 - '@types/node': ^20.0.0 || ^22.0.0 || >=24.0.0 - '@vitest/browser-playwright': 4.1.4 - '@vitest/browser-preview': 4.1.4 - '@vitest/browser-webdriverio': 4.1.4 - '@vitest/coverage-istanbul': 4.1.4 - '@vitest/coverage-v8': 4.1.4 - '@vitest/ui': 4.1.4 + '@types/node': ^22.0.0 || >=24.0.0 + '@vitest/browser-playwright': 5.0.0 + '@vitest/browser-preview': 5.0.0 + '@vitest/browser-webdriverio': ^5.0.0-beta.5 || >=5.0.0 + '@vitest/coverage-istanbul': 5.0.0 + '@vitest/coverage-v8': 5.0.0 + '@vitest/ui': 5.0.0 happy-dom: '*' jsdom: '*' - vite: ^6.0.0 || ^7.0.0 || ^8.0.0 + vite: ^6.4.0 || ^7.0.0 || ^8.0.0 peerDependenciesMeta: '@edge-runtime/vm': optional: true @@ -25100,17 +25091,19 @@ snapshots: picocolors: 1.1.1 pretty-format: 27.5.1 - '@testing-library/jest-dom@6.6.3': + '@testing-library/jest-dom@7.0.1(@testing-library/dom@10.4.1)(vitest@5.0.0)': dependencies: '@adobe/css-tools': 4.4.0 + '@testing-library/dom': 10.4.1 aria-query: 5.3.2 - chalk: 3.0.0 css.escape: 1.5.1 dom-accessibility-api: 0.6.3 - lodash: 4.18.1 + picocolors: 1.1.1 redent: 3.0.0 + optionalDependencies: + vitest: 5.0.0(@opentelemetry/api@1.9.1)(@types/node@22.13.14)(@vitest/coverage-v8@5.0.0)(@vitest/ui@5.0.0)(jsdom@28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1))(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) - '@testing-library/react@16.0.0(@testing-library/dom@10.4.1)(@types/react-dom@19.2.3(@types/react@19.2.14))(@types/react@19.2.14)(react-dom@19.2.6(react@19.2.6))(react@19.2.6)': + '@testing-library/react@16.3.3(@testing-library/dom@10.4.1)(@types/react-dom@19.2.3(@types/react@19.2.14))(@types/react@19.2.14)(react-dom@19.2.6(react@19.2.6))(react@19.2.6)': dependencies: '@babel/runtime': 7.26.10 '@testing-library/dom': 10.4.1 @@ -25935,72 +25928,55 @@ snapshots: vite: 8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0) vue: 3.5.41(typescript@6.0.2) - '@vitest/coverage-v8@4.1.4(vitest@4.1.4)': + '@vitest/coverage-v8@5.0.0(vitest@5.0.0)': dependencies: '@bcoe/v8-coverage': 1.0.2 - '@vitest/utils': 4.1.4 - ast-v8-to-istanbul: 1.0.0 - istanbul-lib-coverage: 3.2.2 - istanbul-lib-report: 3.0.1 - istanbul-reports: 3.2.0 + '@vitest/istanbul-lib-coverage': 1.0.1 + '@vitest/istanbul-lib-report': 1.0.1 + ast-v8-to-istanbul: 1.0.5 magicast: 0.5.4 - obug: 2.1.1 + obug: 2.1.4 std-env: 4.2.0 - tinyrainbow: 3.1.0 - vitest: 4.1.4(@opentelemetry/api@1.9.1)(@types/node@22.13.14)(@vitest/coverage-v8@4.1.4)(@vitest/ui@4.1.4)(jsdom@28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1))(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) + tinyrainbow: 3.1.1 + vitest: 5.0.0(@opentelemetry/api@1.9.1)(@types/node@22.13.14)(@vitest/coverage-v8@5.0.0)(@vitest/ui@5.0.0)(jsdom@28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1))(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) - '@vitest/expect@4.1.4': + '@vitest/istanbul-lib-coverage@1.0.1': {} + + '@vitest/istanbul-lib-report@1.0.1': dependencies: - '@standard-schema/spec': 1.1.0 - '@types/chai': 5.2.2 - '@vitest/spy': 4.1.4 - '@vitest/utils': 4.1.4 - chai: 6.2.2 - tinyrainbow: 3.1.0 + '@vitest/istanbul-lib-coverage': 1.0.1 - '@vitest/mocker@4.1.4(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0))': + '@vitest/mocker@5.0.0(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0))': dependencies: - '@vitest/spy': 4.1.4 + '@jridgewell/trace-mapping': 0.3.31 + '@vitest/spy': 5.0.0 estree-walker: 3.0.3 - magic-string: 0.30.21 + magic-string: 1.2.3 optionalDependencies: msw: 2.11.3(@types/node@22.13.14)(typescript@6.0.2) vite: 8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0) - '@vitest/pretty-format@4.1.4': + '@vitest/pretty-format@5.0.0': dependencies: - tinyrainbow: 3.1.0 + tinyrainbow: 3.1.1 - '@vitest/runner@4.1.4': - dependencies: - '@vitest/utils': 4.1.4 - pathe: 2.0.3 + '@vitest/spy@5.0.0': {} - '@vitest/snapshot@4.1.4': + '@vitest/ui@5.0.0(vitest@5.0.0)': dependencies: - '@vitest/pretty-format': 4.1.4 - '@vitest/utils': 4.1.4 - magic-string: 0.30.21 - pathe: 2.0.3 - - '@vitest/spy@4.1.4': {} - - '@vitest/ui@4.1.4(vitest@4.1.4)': - dependencies: - '@vitest/utils': 4.1.4 - fflate: 0.8.2 - flatted: 3.4.2 + '@vitest/utils': 5.0.0 + fflate: 0.8.3 + flatted: 3.4.4 pathe: 2.0.3 sirv: 3.0.2 - tinyglobby: 0.2.17 - tinyrainbow: 3.1.0 - vitest: 4.1.4(@opentelemetry/api@1.9.1)(@types/node@22.13.14)(@vitest/coverage-v8@4.1.4)(@vitest/ui@4.1.4)(jsdom@28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1))(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) + tinyrainbow: 3.1.1 + vitest: 5.0.0(@opentelemetry/api@1.9.1)(@types/node@22.13.14)(@vitest/coverage-v8@5.0.0)(@vitest/ui@5.0.0)(jsdom@28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1))(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) - '@vitest/utils@4.1.4': + '@vitest/utils@5.0.0': dependencies: - '@vitest/pretty-format': 4.1.4 + '@vitest/pretty-format': 5.0.0 convert-source-map: 2.0.0 - tinyrainbow: 3.1.0 + tinyrainbow: 3.1.1 '@vue-macros/common@3.1.4(vue@3.5.41(typescript@6.0.2))': dependencies: @@ -26632,7 +26608,7 @@ snapshots: dependencies: tslib: 2.8.1 - ast-v8-to-istanbul@1.0.0: + ast-v8-to-istanbul@1.0.5: dependencies: '@jridgewell/trace-mapping': 0.3.31 estree-walker: 3.0.3 @@ -27115,11 +27091,6 @@ snapshots: escape-string-regexp: 1.0.5 supports-color: 5.5.0 - chalk@3.0.0: - dependencies: - ansi-styles: 4.3.0 - supports-color: 7.2.0 - chalk@4.1.2: dependencies: ansi-styles: 4.3.0 @@ -28323,6 +28294,8 @@ snapshots: es-module-lexer@2.1.0: {} + es-module-lexer@2.3.2: {} + es-object-atoms@1.1.1: dependencies: es-errors: 1.3.0 @@ -28893,7 +28866,7 @@ snapshots: dependencies: fill-range: 2.2.4 - expect-type@1.3.0: {} + expect-type@1.4.0: {} exponential-backoff@3.1.1: {} @@ -29114,6 +29087,8 @@ snapshots: fflate@0.8.2: {} + fflate@0.8.3: {} + fft.js@4.0.4: {} figures@3.2.0: @@ -29199,6 +29174,8 @@ snapshots: flatted@3.4.2: {} + flatted@3.4.4: {} + flattie@1.1.1: {} fnv1a-64@0.1.2: {} @@ -29509,8 +29486,6 @@ snapshots: slash: 5.1.0 unicorn-magic: 0.4.0 - globrex@0.1.2: {} - goober@2.1.19(csstype@3.2.3): dependencies: csstype: 3.2.3 @@ -30457,19 +30432,6 @@ snapshots: isomorphic.js@0.2.5: {} - istanbul-lib-coverage@3.2.2: {} - - istanbul-lib-report@3.0.1: - dependencies: - istanbul-lib-coverage: 3.2.2 - make-dir: 4.0.0 - supports-color: 7.2.0 - - istanbul-reports@3.2.0: - dependencies: - html-escaper: 2.0.2 - istanbul-lib-report: 3.0.1 - iterator.prototype@1.1.5: dependencies: define-data-property: 1.1.4 @@ -31055,6 +31017,10 @@ snapshots: dependencies: '@jridgewell/sourcemap-codec': 1.5.5 + magic-string@1.2.3: + dependencies: + '@jridgewell/sourcemap-codec': 1.5.5 + magicast@0.5.4: dependencies: '@babel/parser': 7.29.8 @@ -31065,10 +31031,6 @@ snapshots: dependencies: semver: 6.3.1 - make-dir@4.0.0: - dependencies: - semver: 7.8.5 - make-fetch-happen@13.0.1(supports-color@8.1.1): dependencies: '@npmcli/agent': 2.2.2(supports-color@8.1.1) @@ -32904,6 +32866,8 @@ snapshots: obug@2.1.1: {} + obug@2.1.4: {} + ofetch@1.5.1: dependencies: destr: 2.0.5 @@ -33368,6 +33332,8 @@ snapshots: picomatch@4.0.5: {} + picomatch@4.0.7: {} + pidtree@0.3.1: {} pify@3.0.0: {} @@ -35598,12 +35564,14 @@ snapshots: tiny-invariant@1.3.3: {} - tinybench@2.9.0: {} + tinybench@6.1.4: {} tinyclip@0.1.15: {} tinyexec@1.2.4: {} + tinyexec@1.3.0: {} + tinyglobby@0.2.15: dependencies: fdir: 6.5.0(picomatch@4.0.5) @@ -35619,7 +35587,7 @@ snapshots: fdir: 6.5.0(picomatch@4.0.5) picomatch: 4.0.5 - tinyrainbow@3.1.0: {} + tinyrainbow@3.1.1: {} title-case@3.0.3: dependencies: @@ -35702,10 +35670,6 @@ snapshots: '@ts-morph/common': 0.27.0 code-block-writer: 13.0.3 - tsconfck@3.0.3(typescript@6.0.2): - optionalDependencies: - typescript: 6.0.2 - tsconfig-paths@3.15.0: dependencies: '@types/json5': 0.0.29 @@ -36489,26 +36453,6 @@ snapshots: vite: 7.3.5(@types/node@22.13.14)(jiti@2.7.0)(lightningcss@1.33.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0) vue: 3.5.41(typescript@6.0.2) - vite-tsconfig-paths@6.1.1(supports-color@8.1.1)(typescript@6.0.2)(vite@7.3.5(@types/node@22.13.14)(jiti@2.7.0)(lightningcss@1.33.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)): - dependencies: - debug: 4.4.3(supports-color@8.1.1) - globrex: 0.1.2 - tsconfck: 3.0.3(typescript@6.0.2) - vite: 7.3.5(@types/node@22.13.14)(jiti@2.7.0)(lightningcss@1.33.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0) - transitivePeerDependencies: - - supports-color - - typescript - - vite-tsconfig-paths@6.1.1(supports-color@8.1.1)(typescript@6.0.2)(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)): - dependencies: - debug: 4.4.3(supports-color@8.1.1) - globrex: 0.1.2 - tsconfck: 3.0.3(typescript@6.0.2) - vite: 8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0) - transitivePeerDependencies: - - supports-color - - typescript - vite@7.3.5(@types/node@22.13.14)(jiti@2.7.0)(lightningcss@1.33.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0): dependencies: esbuild: 0.28.1 @@ -36548,33 +36492,27 @@ snapshots: optionalDependencies: vite: 8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0) - vitest@4.1.4(@opentelemetry/api@1.9.1)(@types/node@22.13.14)(@vitest/coverage-v8@4.1.4)(@vitest/ui@4.1.4)(jsdom@28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1))(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)): + vitest@5.0.0(@opentelemetry/api@1.9.1)(@types/node@22.13.14)(@vitest/coverage-v8@5.0.0)(@vitest/ui@5.0.0)(jsdom@28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1))(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)): dependencies: - '@vitest/expect': 4.1.4 - '@vitest/mocker': 4.1.4(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) - '@vitest/pretty-format': 4.1.4 - '@vitest/runner': 4.1.4 - '@vitest/snapshot': 4.1.4 - '@vitest/spy': 4.1.4 - '@vitest/utils': 4.1.4 - es-module-lexer: 2.1.0 - expect-type: 1.3.0 - magic-string: 0.30.21 - obug: 2.1.1 - pathe: 2.0.3 - picomatch: 4.0.5 + '@types/chai': 5.2.2 + '@vitest/mocker': 5.0.0(msw@2.11.3(@types/node@22.13.14)(typescript@6.0.2))(vite@8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0)) + chai: 6.2.2 + es-module-lexer: 2.3.2 + expect-type: 1.4.0 + magic-string: 1.2.3 + obug: 2.1.4 + picomatch: 4.0.7 std-env: 4.2.0 - tinybench: 2.9.0 - tinyexec: 1.2.4 + tinybench: 6.1.4 + tinyexec: 1.3.0 tinyglobby: 0.2.17 - tinyrainbow: 3.1.0 vite: 8.2.1(@types/node@22.13.14)(esbuild@0.28.1)(jiti@2.7.0)(sass@1.77.4)(terser@5.48.0)(tsx@4.22.4)(yaml@2.9.0) why-is-node-running: 2.3.0 optionalDependencies: '@opentelemetry/api': 1.9.1 '@types/node': 22.13.14 - '@vitest/coverage-v8': 4.1.4(vitest@4.1.4) - '@vitest/ui': 4.1.4(vitest@4.1.4) + '@vitest/coverage-v8': 5.0.0(vitest@5.0.0) + '@vitest/ui': 5.0.0(vitest@5.0.0) jsdom: 28.1.0(@noble/hashes@1.8.0)(supports-color@8.1.1) transitivePeerDependencies: - msw diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 2b643f53d98af..ddb6f3dbb9f03 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -32,8 +32,8 @@ catalog: # https://devblogs.microsoft.com/typescript/announcing-typescript-7-0/ '@typescript/native': npm:typescript@~7.0.2 '@vitejs/plugin-react': ^6.0.1 - '@vitest/coverage-v8': ^4.1.4 - '@vitest/ui': ^4.1.4 + '@vitest/coverage-v8': ^5.0.0 + '@vitest/ui': ^5.0.0 lodash: ^4.18.1 lodash-es: ^4.18.1 monaco-editor: 0.52.2 @@ -50,8 +50,7 @@ catalog: valtio: ^2.3.2 vite: ^8.0.16 velite: ^0.4.0 - vite-tsconfig-paths: ^6.1.1 - vitest: ^4.1.4 + vitest: ^5.0.0 zod: 3.25.76 allowBuilds: