From e83562e3f4870c3a5c893917b8b5a8a715826c84 Mon Sep 17 00:00:00 2001 From: zeekay Date: Sun, 19 Jul 2026 19:52:14 -0700 Subject: [PATCH] =?UTF-8?q?fix(explore/test):=20green=20vitest=20unit=20su?= =?UTF-8?q?ite=20=E2=80=94=20drop=20removed=20GrowthBook=20dep=20refs,=20s?= =?UTF-8?q?cope=20out=20live-E2E=20(v1.1.13)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two root causes broke the vitest unit suite (6 suites failing → 29/29 green): 1. @growthbook/growthbook-react was intentionally removed from package.json in the registry-cleanup commit (888ef29) and is unused anywhere in the app, but the shared test render helpers (vitest/lib.tsx, playwright/TestApp.tsx) still wrapped children in a dead . Vite failed to resolve the missing module, killing 5 suites that use the helper. Fix: remove the dead import + wrapper (the provider held no growthbook instance and no feature flags are consumed — it was a no-op). Do not re-add a deleted dependency. 2. tests/e2e/live-explorers.spec.ts is a Playwright live-infra E2E spec (imports @playwright/test, hits live explorer URLs). It matched the vitest include glob **/*.spec.ts and crashed the run. Fix: exclude **/tests/e2e/** from vitest — those run under the Playwright runner (pnpm test:pw*), not the unit suite. Also normalized pre-existing over-indentation in TestApp.tsx return block. Before: 6 failed / 24 passed suites. After: 29/29 suites, 267/267 tests green. Co-authored-by: Hanzo Dev --- package.json | 2 +- playwright/TestApp.tsx | 33 +++++++++++++++------------------ vitest.config.ts | 5 ++++- vitest/lib.tsx | 9 +++------ 4 files changed, 23 insertions(+), 26 deletions(-) diff --git a/package.json b/package.json index 47988a8e5..67a4b6ea4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@luxfi/explore", - "version": "1.1.12", + "version": "1.1.13", "private": false, "homepage": "https://github.com/luxfi/explore#readme", "engines": { diff --git a/playwright/TestApp.tsx b/playwright/TestApp.tsx index 641728a7a..ca157d4af 100644 --- a/playwright/TestApp.tsx +++ b/playwright/TestApp.tsx @@ -1,4 +1,3 @@ -import { GrowthBookProvider } from '@growthbook/growthbook-react'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import React from 'react'; import { http } from 'viem'; @@ -72,23 +71,21 @@ const TestApp = ({ children, withSocket, appContext = defaultAppContext, marketp })); return ( - - - - - - - - - { children } - - - - - - - - + + + + + + + + { children } + + + + + + + ); }; diff --git a/vitest.config.ts b/vitest.config.ts index f81fb71aa..dc0474cd0 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -12,6 +12,9 @@ export default defineConfig({ globalSetup: [ './vitest/global-setup.ts' ], setupFiles: [ './vitest/setup.ts' ], include: [ '**/*.spec.ts', '**/*.spec.tsx' ], - exclude: [ '**/node_modules/**', '**/node_modules_linux/**' ], + // tests/e2e/** holds Playwright live-infra E2E specs (import '@playwright/test', + // hit live explorer URLs). They run under the Playwright runner (pnpm test:pw*), + // not vitest — exclude them from the unit suite. + exclude: [ '**/node_modules/**', '**/node_modules_linux/**', '**/tests/e2e/**' ], }, }); diff --git a/vitest/lib.tsx b/vitest/lib.tsx index dff17ee1b..876495c12 100644 --- a/vitest/lib.tsx +++ b/vitest/lib.tsx @@ -1,4 +1,3 @@ -import { GrowthBookProvider } from '@growthbook/growthbook-react'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import type { RenderOptions } from '@testing-library/react'; import { render } from '@testing-library/react'; @@ -31,11 +30,9 @@ const TestApp = ({ children }: { children: React.ReactNode }) => { return ( - - - { children } - - + + { children } + );