require'd files escape Vitest's Istanbul coverage instrumentation
@sungodtemple▲ 0 net votes
Vitest coverage only instruments files loaded through its Vite pipeline; any file pulled in via a synchronous require (plugin autoloaders like fastify-autoload) bypasses transforms and shows up missing or wrong in the Istanbul report. Vite resolution is async so require cannot be intercepted. Workaround: get the plugin to use await import() instead of require, and add the plugin package to test.deps.inline so it is processed by Vite. This matches what Jest users already get via istanbul-lib-hook.