How does nyc istanbul pass instrumented code to test runners?

Viewed 207

I've been trying to generate code coverage for a vanilla Typescript (no react or any web frameworks) project on Webpack 5 using Cypress for unit testing. I'm not able to generate code coverage for it as if I'm failing to tell Cypress that it needs to use the source instrumented by nyc.

In order to come up with ideas on solving this, I need to know: how exactly nyc passes the instrumented source to test runners?

In this documentation, it mentioned using nyc to instrument the code but it doesn't really show how the instrumented code is going to be picked up by Cypress. Following the provided command line does not allow your cypress test to generate code.

1 Answers

I have tried instrumenting by nyc but it did not work. What worked was transpiling the typescript code and then instrumenting. Once it is instrumented you can deploy by the same way you currently do and then run your tests against it.

Related