Skip to content

Commit 445b44d

Browse files
JOHNJOHN
authored andcommitted
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.
1 parent 300c2d6 commit 445b44d

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

src/popup/__tests__/App.integration.test.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,14 @@ describe('Popup App Integration', () => {
127127

128128
const renderPopup = async () => {
129129
const { SessionProvider } = await import('../../contexts/SessionContext');
130+
const { ThemeProvider } = await import('../../contexts/ThemeContext');
130131
await act(async () => {
131132
render(
132-
<SessionProvider>
133-
<App />
134-
</SessionProvider>
133+
<ThemeProvider>
134+
<SessionProvider>
135+
<App />
136+
</SessionProvider>
137+
</ThemeProvider>
135138
);
136139
});
137140
};

src/sidepanel/__tests__/App.integration.test.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,14 @@ describe('Sidepanel App Integration', () => {
175175

176176
const renderSidepanel = async () => {
177177
const { SessionProvider } = await import('../../contexts/SessionContext');
178+
const { ThemeProvider } = await import('../../contexts/ThemeContext');
178179
await act(async () => {
179180
render(
180-
<SessionProvider>
181-
<App />
182-
</SessionProvider>
181+
<ThemeProvider>
182+
<SessionProvider>
183+
<App />
184+
</SessionProvider>
185+
</ThemeProvider>
183186
);
184187
});
185188
};

vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default defineConfig({
3939
plugins: [react(), copyStaticFiles()],
4040
build: {
4141
outDir: 'dist',
42-
sourcemap: true,
42+
sourcemap: process.env.NODE_ENV !== 'production',
4343
minify: 'esbuild',
4444
target: 'es2020',
4545
rollupOptions: {

vite.content.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { resolve } from 'path';
55
export default defineConfig({
66
build: {
77
outDir: 'dist',
8-
sourcemap: true,
8+
sourcemap: process.env.NODE_ENV !== 'production',
99
minify: 'esbuild',
1010
target: 'es2020',
1111
emptyOutDir: false, // Don't clear the dist folder (main build already created it)

0 commit comments

Comments
 (0)