0

I'm currently working in obtain the code coverage report from my Cypress tests, to do so I use nyc istambul to instrument the code and code-coverage plugin to obtain the report.

Take in account that our program works with react-app-rewired and has a modular structure, also our backend is launched with apache tomcat.

├── node_modules
├── config
│  └── eclipse
│  └ ...
.
.
.
├── modules
│  └── module_main
│     ├── web-jspack
│        ├── package.json
│        ├── src
│        ├── src-test
│           ├── cypress ...
│           ├── ...
│        ├── config-overrides.js
│  └── module_1
│     ├── web-jspack
│        ├── package.json
│        ├── src
│        ├── src-test
│           ├── cypress ...
│           ├── ...   
│  └── module_2
│     ├── ...
├── gulpfile.js
├── node_modules
├── package-lock.json
├── package.json
├── README.md
├── src
├── .nycrc

NOTE: I'm using "nyc istambul" instead "instrument-cra" plugin due the modularity of our program. When instrument-cra plugin is used, it only works for the main module, and the others are not taken in account.

So, first I instrument the necessary code (src folders from some modules), replace src folder with the instrumented version and start a dev build (from main_module: npm start), wait for compilation and then I can obtain a code coverage from the tests if launched vs dev build.

Now, we want to implement it in CI/CD (Jenkins), which uses the production build to launch Cypress tests, as to launch a production build, it compiles src folders to java and saves it in /tomcat/webapp/appName/...

Therefore I'm currently searching how to instrument the code with this conditions, is it even possible? If not, does someone know how can I obtain a code coverage report taking in account the above mentioned?

André
  • 1
  • 1

0 Answers0