From 445b44d68d6b6292c8f0019300ad7cb73f7651ed Mon Sep 17 00:00:00 2001 From: JOHN Date: Fri, 12 Dec 2025 13:48:41 -0500 Subject: [PATCH] fix: Phase 1 critical fixes - test suite and source maps - Add ThemeProvider wrapper to popup and sidepanel integration tests - Fixes 22 failing tests due to missing ThemeProvider context - Tests now properly wrap components with both ThemeProvider and SessionProvider - Disable source maps in production builds - Update vite.config.ts to only generate source maps in development - Update vite.content.config.ts to only generate source maps in development - Prevents source code exposure in production distribution Addresses critical issues from production audit report: - Test suite broken (blocks CI/CD) - Source maps in production (security concern) Phase 1 of comprehensive production audit remediation plan. --- src/popup/__tests__/App.integration.test.tsx | 9 ++++++--- src/sidepanel/__tests__/App.integration.test.tsx | 9 ++++++--- vite.config.ts | 2 +- vite.content.config.ts | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/popup/__tests__/App.integration.test.tsx b/src/popup/__tests__/App.integration.test.tsx index 48c9adf..dafba4c 100644 --- a/src/popup/__tests__/App.integration.test.tsx +++ b/src/popup/__tests__/App.integration.test.tsx @@ -127,11 +127,14 @@ describe('Popup App Integration', () => { const renderPopup = async () => { const { SessionProvider } = await import('../../contexts/SessionContext'); + const { ThemeProvider } = await import('../../contexts/ThemeContext'); await act(async () => { render( - - - + + + + + ); }); }; diff --git a/src/sidepanel/__tests__/App.integration.test.tsx b/src/sidepanel/__tests__/App.integration.test.tsx index a811cfb..4b8a834 100644 --- a/src/sidepanel/__tests__/App.integration.test.tsx +++ b/src/sidepanel/__tests__/App.integration.test.tsx @@ -175,11 +175,14 @@ describe('Sidepanel App Integration', () => { const renderSidepanel = async () => { const { SessionProvider } = await import('../../contexts/SessionContext'); + const { ThemeProvider } = await import('../../contexts/ThemeContext'); await act(async () => { render( - - - + + + + + ); }); }; diff --git a/vite.config.ts b/vite.config.ts index 1bdb0f5..749028e 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -39,7 +39,7 @@ export default defineConfig({ plugins: [react(), copyStaticFiles()], build: { outDir: 'dist', - sourcemap: true, + sourcemap: process.env.NODE_ENV !== 'production', minify: 'esbuild', target: 'es2020', rollupOptions: { diff --git a/vite.content.config.ts b/vite.content.config.ts index bab8f72..dae5bf7 100644 --- a/vite.content.config.ts +++ b/vite.content.config.ts @@ -5,7 +5,7 @@ import { resolve } from 'path'; export default defineConfig({ build: { outDir: 'dist', - sourcemap: true, + sourcemap: process.env.NODE_ENV !== 'production', minify: 'esbuild', target: 'es2020', emptyOutDir: false, // Don't clear the dist folder (main build already created it)