Unifying test coverage

Therefore, let's add coverage scripts for integration and E2E tests:

"test:coverage": "nyc --reporter=html --reporter=text yarn run test","test:integration:coverage": "nyc --reporter=html --reporter=text yarn run test:integration","test:e2e:coverage": "nyc --reporter=html --reporter=text yarn run test:e2e",

However, when we run the test:e2e:coverage script, the coverage report shows results for compiled files in the dist/ directory, rather than the source files from src/. This is because our E2E test script (scripts/e2e.test.sh) is running the serve npm script, which transpiles our code before running it. To fix this, let's add a new test:serve script, which uses babel-node to directly run our code:

"test:serve": "dotenv ...

Get Building Enterprise JavaScript Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.