help icon indicating copy to clipboard operation
help copied to clipboard

How does code coverage actually work?

Open anilhelvaci opened this issue 5 months ago • 3 comments

Node.js Version

v23.0.0-pre

NPM Version

9.8.1

Operating System

Darwin Anils-MacBook-Pro.local 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000 arm64

Subsystem

Other

Description

Context

I recently decided to contribute to Node.js and the most logical place for me to start seemed to improve code coverage. I went to https://app.codecov.io/gh/nodejs/node to look for a file that has a low coverage. I chose domexception.js as it has 58.17% coverage.

image

What is the problem?

As I explore more of the Node.js project, I focused on test/wpt/test-domexception.js as my primary source of tests to work on.

However, when I run make coverage-run-js I get 58.82% of coverage BUT if I run the test-domexception.js individually as described in Running Coverage my results are close to 100% like below:

image

What would solve my problem?

Answers to the question below would solve my problem;

  • When trying to improve test coverage, how does the development cycle look for a regular nodejs dev?
  • What should be my source of truth when working on improving test coverage?
  • Does the fact that test-domexception.js being run in a WPTRunner cause additional complexity when it comes to code coverage?

Any sort of assistance would be greatly appreciated. Thanks 🙏

Minimal Reproduction

No response

Output

No response

Before You Submit

  • [X] I have looked for issues that already exist before submitting this
  • [X] My issue follows the guidelines in the README file, and follows the 'How to ask a good question' guide at https://stackoverflow.com/help/how-to-ask

anilhelvaci avatar Aug 27 '24 11:08 anilhelvaci