How to include monorepo packages in Cypress code coverage

I have multi packages in monorepo.

/pkg1
/pkg2
/pkg3
     - react-app
     - cypress
     - src
     - package.json

I am using @cypress/instrument-cra to collect coverage and it works only to cover the code inside react-app.

I need to go further because react-app is actually just a playground while the src has to be covered along with other packages that are used inside the react-app. I am importing packages as following:

import pkg1 from @myProject/pkg1

How can I use code coverage for pkg1?

I tried to config nyc but it didn’t work

"nyc": {
  "all": true,
  "include": [
    "node_modules"
  ],
  "excludeNodeModules": false
}

Thanks!

33 thoughts on “How to include monorepo packages in Cypress code coverage”

  1. 651093 689575Jeden Tag stellt man sich die Frage Was Koche Ich Heute?! Zerbrechen Sie sich nicht den Kopf, besuchen Sie uns am besten direkt auf unserer Webseite uns lassen Sie sich inspirieren 358364

    Reply