You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(coverage): resolve imports to src/*.ts for accurate v8 coverage attribution
Coverage was reporting ~50% because imports resolved to dist/*.js CJS
bundles instead of src/*.ts source files. The v8 provider instruments
runtime execution, so coverage was attributed to dist/ files which the
coverage config excluded from reporting.
Root causes:
- Vitest's internal config hooks override resolve.alias and
resolve.conditions, so user-provided aliases were never applied
- The cover script did not pass --config to vitest, so the vitest
config file was never loaded for coverage runs
Fix:
- Add "source" export condition to all 147 package.json export entries,
pointing to the corresponding src/*.ts file
- Replace resolve.alias with a Vite plugin (sourceResolverPlugin) that
uses resolveId to intercept @socketsecurity/lib/* imports and map
them to src/*.ts, bypassing vitest's config override behavior
- Fix cover script to pass --config .config/vitest.config.mts
- Remove single-thread constraint for coverage (no longer needed)
- Increase archive test timeouts for coverage mode compatibility
- Raise coverage thresholds to match new baseline (~80% lines)
Coverage: 50% -> 81% lines, 34% -> 70% branches, 53% -> 90% functions
[](https://bsky.app/profile/socket.dev)
0 commit comments