mirror of
https://github.com/luxfi/explore.git
synced 2026-07-27 03:13:50 +00:00
fix(explore/test): green vitest unit suite — drop removed GrowthBook dep refs, scope out live-E2E (v1.1.13)
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 <GrowthBookProvider>. 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 <dev@hanzo.ai>
This commit is contained in:
+1
-1
@@ -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": {
|
||||
|
||||
+15
-18
@@ -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 (
|
||||
<QueryClientProvider client={ queryClient }>
|
||||
<SocketProvider url={ withSocket ? `ws://${ config.app.host }:${ socketPort }` : undefined }>
|
||||
<AppContextProvider { ...appContext }>
|
||||
<MarketplaceContext.Provider value={ marketplaceContext }>
|
||||
<SettingsContextProvider>
|
||||
<GrowthBookProvider>
|
||||
<WagmiProvider config={ wagmiConfig! }>
|
||||
<RewardsContextProvider>
|
||||
{ children }
|
||||
</RewardsContextProvider>
|
||||
</WagmiProvider>
|
||||
</GrowthBookProvider>
|
||||
</SettingsContextProvider>
|
||||
</MarketplaceContext.Provider>
|
||||
</AppContextProvider>
|
||||
</SocketProvider>
|
||||
</QueryClientProvider>
|
||||
<QueryClientProvider client={ queryClient }>
|
||||
<SocketProvider url={ withSocket ? `ws://${ config.app.host }:${ socketPort }` : undefined }>
|
||||
<AppContextProvider { ...appContext }>
|
||||
<MarketplaceContext.Provider value={ marketplaceContext }>
|
||||
<SettingsContextProvider>
|
||||
<WagmiProvider config={ wagmiConfig! }>
|
||||
<RewardsContextProvider>
|
||||
{ children }
|
||||
</RewardsContextProvider>
|
||||
</WagmiProvider>
|
||||
</SettingsContextProvider>
|
||||
</MarketplaceContext.Provider>
|
||||
</AppContextProvider>
|
||||
</SocketProvider>
|
||||
</QueryClientProvider>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
+4
-1
@@ -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/**' ],
|
||||
},
|
||||
});
|
||||
|
||||
+3
-6
@@ -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 (
|
||||
<QueryClientProvider client={ queryClient }>
|
||||
<AppContextProvider pageProps={ PAGE_PROPS }>
|
||||
<GrowthBookProvider>
|
||||
<SocketProvider>
|
||||
{ children }
|
||||
</SocketProvider>
|
||||
</GrowthBookProvider>
|
||||
<SocketProvider>
|
||||
{ children }
|
||||
</SocketProvider>
|
||||
</AppContextProvider>
|
||||
</QueryClientProvider>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user