mirror of
https://github.com/denoland/deno.git
synced 2025-07-24 05:35:33 +00:00
fix(coverage): ensure coverage is only collected in certain situations (#15467)
This commit is contained in:
parent
ee2f4e745c
commit
8eed24cd3d
7 changed files with 60 additions and 12 deletions
|
@ -278,8 +278,25 @@ impl CliOptions {
|
|||
self.flags.compat
|
||||
}
|
||||
|
||||
pub fn coverage_dir(&self) -> Option<&String> {
|
||||
self.flags.coverage_dir.as_ref()
|
||||
pub fn coverage_dir(&self) -> Option<String> {
|
||||
fn allow_coverage(sub_command: &DenoSubcommand) -> bool {
|
||||
match sub_command {
|
||||
DenoSubcommand::Test(_) => true,
|
||||
DenoSubcommand::Run(flags) => !flags.is_stdin(),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
if allow_coverage(self.sub_command()) {
|
||||
self
|
||||
.flags
|
||||
.coverage_dir
|
||||
.as_ref()
|
||||
.map(ToOwned::to_owned)
|
||||
.or_else(|| env::var("DENO_UNSTABLE_COVERAGE_DIR").ok())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn enable_testing_features(&self) -> bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue