Has anyone been able to implement instrumentation and code coverage in next js 14?
Unanswered
Donskoy posted this in #help-forum
DonskoyOP
Hello everyone! I wanted to ask a quick question: has anyone been able to get instrumentation and code coverage working in Next.js 14?
I've looked everywhere, but Istanbul doesn't seem to work and I haven't found any other workable way to instrument the code to get coverage later (using cypress, playwright, etc).
I really like Next.js, but due to the policies of where I work, if I can't implement code coverage, I can't proceed to use it.
If anyone knows anything about this I'd appreciate it.
I've looked everywhere, but Istanbul doesn't seem to work and I haven't found any other workable way to instrument the code to get coverage later (using cypress, playwright, etc).
I really like Next.js, but due to the policies of where I work, if I can't implement code coverage, I can't proceed to use it.
If anyone knows anything about this I'd appreciate it.
2 Replies
Yellow-horned horntail
I am trying to set it up but have not had success yet. I just posted a specific question here:
https://nextjs-forum.com/post/1199778505525825586
@Donskoy, I'm assuming you are following the instrumentation doc. Can you share what you've tried and what problem you are running into? (Doc here:)
https://nextjs.org/docs/app/building-your-application/optimizing/instrumentation
https://nextjs-forum.com/post/1199778505525825586
@Donskoy, I'm assuming you are following the instrumentation doc. Can you share what you've tried and what problem you are running into? (Doc here:)
https://nextjs.org/docs/app/building-your-application/optimizing/instrumentation
Yellow-horned horntail
OK, I found my answer here. I was needing to scope to only run when
https://github.com/DataDog/dd-trace-js/issues/3457#issuecomment-1669499660
process.env.NEXT_RUNTIME === 'nodejs'.https://github.com/DataDog/dd-trace-js/issues/3457#issuecomment-1669499660