Skip to content

feat(cli): add --coverage flag to deno run command #29329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

kt3k
Copy link
Member

@kt3k kt3k commented May 16, 2025

closes #16440

This PR adds --coverage flag to deno run command. When the flag is specified, it generates the coverage profile in the directory specified (default is coverage). The coverage directory can also be specified from the env var DENO_COVERAGE_DIR.

.conflicts_with("inspect-wait")
.conflicts_with("inspect-brk")
.help(cstr!("Collect coverage profile data into DIR. If DIR is not specified, it uses 'coverage/'.
<p(245)>This option can also be set via the DENO_UNSTABLE_COVERAGE_DIR environment variable."))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be DENO_COVERAGE_DIR instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intentionally made this DENO_UNSTABLE_COVERAGE_DIR at this point to avoid causing child process generating the coverage immediately after landing this PR.

I assume we would change this to DENO_COVERAGE_DIR when we stabilize this feature (at that point the child process start generating coverage data. I think that should happen at next minor version)

Copy link
Contributor

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kt3k kt3k added this to the 2.4.0 milestone May 21, 2025
@kt3k kt3k changed the title feat(cli/unstable): add --unstable-coverage flag to deno run command feat(cli): add --coverage flag to deno run command May 21, 2025
@kt3k
Copy link
Member Author

kt3k commented May 21, 2025

Discussed with @bartlomieju, and changed this to stable feature, targeting the next minor version.

@kt3k kt3k changed the title feat(cli): add --coverage flag to deno run command feat(cli): add --coverage flag to deno run command May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FR: Consider adding deno run --coverage (coverage from subprocess of deno test)
2 participants