mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-26 05:14:27 +00:00
fix(ui): pre-optimize @peculiar/x509 and reflect-metadata for vitest browser
The Azure certificate generator (PROWLER-2378) imports @peculiar/x509 and reflect-metadata. Without them in vitest.config.ts optimizeDeps.include, Vite discovered them the first time a component test loaded the cert generator lazily and emitted "optimized dependencies changed. reloading" mid-run. That reload races with Playwright's route handlers on the integration project, surfacing as "Unhandled Rejection: There was an error when mocking a module" and taking down the whole run in CI. Pre-bundling both packages up front removes the mid-run reload — verified by clearing node_modules/.vite and rerunning the previously-failing providers-page.integration.test.tsx: 62/62 pass with no reload warning.
This commit is contained in:
1 parent
47c42bbe42
commit
0a6206e9a8
1 file changed
+7
@@ -106,6 +106,13 @@ export default defineConfig(() => {
|
||||
"vitest-browser-react",
|
||||
"msw/browser",
|
||||
|
||||
// Azure certificate generator (PROWLER-2378). Vite would otherwise
|
||||
// discover these two on first import inside a component test, which
|
||||
// triggers a mid-run "optimized dependencies changed. reloading" and
|
||||
// races with Playwright's route handlers.
|
||||
"@peculiar/x509",
|
||||
"reflect-metadata",
|
||||
|
||||
// React runtime (pre-bundle so a cold run doesn't re-optimize and
|
||||
// reload mid-test — see the on-demand-reload note above).
|
||||
"react-dom/client",
|
||||
|
||||
Reference in new issue
Block a user