Skip to content
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

fix(cli): panic with deno coverage #23353

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

Conversation

0xIchigo
Copy link
Contributor

This PR directly addresses the issue raised in #23282 where Deno panics if deno coverage is called with --include regex that returns no matches.

I've opted not to change the return value of collect_summary for simplicity and return an empty HashMap instead

@dsherret dsherret changed the title fix(cli) Fix panic with deno coverage fix(cli): panic with deno coverage Apr 13, 2024
@bartlomieju
Copy link
Member

Thanks for the PR, could you please add a test case that exercises this change? You can add an itest! check in tests/integration/coverage_tests.rs

@bartlomieju bartlomieju added this to the 1.44 milestone May 5, 2024
@0xIchigo
Copy link
Contributor Author

My apologies @bartlomieju — I missed your initial reply to this PR. I've gone ahead and added a test at tests/integration/coverage_tests.rs

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for the PR. Could you please use assert_contains! macro?

Comment on lines +583 to +588
assert!(
actual.contains(expected_message),
"Expected output to contain '{}', but found:\n{}",
expected_message,
actual
);
Copy link
Member

Choose a reason for hiding this comment

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

You can use assert_contains! macro here to skip manually creating a message

Comment on lines +611 to +615
assert!(
unexpected_contents.is_empty(),
"Expected the coverage directory to be empty except for 'empty_dir', but found: {:?}",
unexpected_contents
);
Copy link
Member

Choose a reason for hiding this comment

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

It's strange that rustfmt didn't dedent this... oh well

unexpected_contents
);

println!("No unexpected coverage files found as expected, test concludes successfully.");
Copy link
Member

Choose a reason for hiding this comment

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

Maybe skip this line, it won't get printed by default anyway

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.

None yet

2 participants