next-and-cypress-example icon indicating copy to clipboard operation
next-and-cypress-example copied to clipboard

Do not instrument production code

Open dopry opened this issue 4 years ago • 2 comments

modify the .babelrc to only apply istanbul instrumentation to development code NODE_ENV is set to development when running next and next dev next build set NODE_ENV to production

dopry avatar Sep 29 '20 20:09 dopry

Can you add notes about setting the NODE_ENV to development when running the tests?

bahmutov avatar Sep 29 '20 20:09 bahmutov

Next sets NODE_ENV to dev when running next dev.

see: https://github.com/vercel/next.js/blob/3e81809df44e5c36a52abc89b46bc53f18b83695/packages/next/bin/next.ts#L87

If just running next you may need to pass it. I don't normally do this in testing. Did you just run next and the instrumentation didn't happen? Is this what I should clarify?

dopry avatar Oct 05 '20 00:10 dopry