-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
feat(coverage): add "--output" flag #13289
feat(coverage): add "--output" flag #13289
Conversation
@bartlomieju |
76f1b5e
to
eb69f8a
Compare
Good point. Let's go with explicit |
@bartlomieju apologies for the delay!! I have resumed working on this and can share progress soon.. |
5143049
to
fbc5b4c
Compare
5d916f1
to
72ce3d2
Compare
290271f
to
1828e2d
Compare
7e8b0b8
to
f242a32
Compare
c61385e
to
51bf12c
Compare
@bartlomieju I noticed |
@VishnuJin no worries, seems like a flake. |
@bartlomieju awaiting for you review 🙂 |
3203842
to
eff2796
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@VishnuJin I just tested this PR and it works nicely, we should land it for 1.19. I found one quirk though, please see comment below
@@ -732,6 +733,17 @@ Generate html reports from lcov: | |||
.help("Output coverage report in lcov format") | |||
.takes_value(false), | |||
) | |||
.arg(Arg::new("output") | |||
.long("output") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This arg should require --lcov
arg to be present, otherwise I can do:
deno coverage --output=cov.lcov cov/
which makes no sense, since it means to print test report to stdout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I somehow missed requires
method in clap and implemented the following which is obviously not so good, and I will change this now
deno/cli/tools/coverage/mod.rs
Lines 618 to 630 in eff2796
// only create file for if '--lcov' flag is passed | |
let mut out_mode: Option<PathBuf> = None; | |
if coverage_flags.lcov { | |
out_mode = match coverage_flags.output { | |
Some(ref path) => match File::create(path) { | |
Ok(_) => Some(PathBuf::from(path)), | |
Err(e) => { | |
return Err(anyhow!("Failed to create output file: {}", e)); | |
} | |
}, | |
None => None, | |
}; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bartlomieju thanks for the hint,
Lines 736 to 738 in c4356c0
.arg(Arg::new("output") | |
.requires("lcov") | |
.long("output") |
Signed-off-by: VishnuJin <vishnujin@outlook.com>
eff2796
to
c4356c0
Compare
@bartlomieju should I do something here ? |
@VishnuJin no, I made a mistake rebasing your PR, need to land other PR first before it's fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you @VishnuJin
This pr adds
output
arg todeno coverage
to pipe the stdout to the given file,just likedeno bundle
fixes #13236