Closed coltonehrman closed 1 year ago
It will show up in the server bundle since it's require()
'd inside pages/api
; however, there's no client entry point for any of the test code so it won't show up in the client-side bundle.
You can test this yourself with https://github.com/vercel/next.js/tree/canary/packages/next-bundle-analyzer
It will show up in the server bundle since it's
require()
'd insidepages/api
; however, there's no client entry point for any of the test code so it won't show up in the client-side bundle.
Does that mean that the production code getting deployed would be instrumented with code coverage lines? That would be a performance hit and not ideal.
It would show up in the server bundle overall; however, I believe API routes are code-split by default with Next.js so only this specific route would include the dependency. Additionally, the instrumentation is for the UI code only. So, I don't see that it's possible for instrumentation code to be included anywhere in your actual application code.
It would show up in the server bundle overall; however, I believe API routes are code-split by default with Next.js so only this specific route would include the dependency. Additionally, the instrumentation is for the UI code only. So, I don't see that it's possible for instrumentation code to be included anywhere in your actual application code.
Ah, so this does not instrument server-side code? So this won't allow me to collect coverage on the server?
Correct. That's an open issue here: https://github.com/kylemh/next-ts-with-cypress-coverage/issues/3
If you find a solution, definitely let me know! It seems to be a limitation of @cypress/code-coverage
Will the istanbul code coverage instrumented code get bundled for production and be part of a production build?