From d99c6c1ea4f5711c3f48c5617d7224852fb294d2 Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Tue, 28 May 2024 12:37:30 +0900 Subject: fix(coverage): handle ignore patterns (#23974) closes #23972 --- tests/integration/coverage_tests.rs | 45 +++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 9 deletions(-) (limited to 'tests/integration/coverage_tests.rs') diff --git a/tests/integration/coverage_tests.rs b/tests/integration/coverage_tests.rs index f6011b054..c1e5055da 100644 --- a/tests/integration/coverage_tests.rs +++ b/tests/integration/coverage_tests.rs @@ -547,14 +547,15 @@ fn test_summary_reporter() { output.assert_exit_code(0); output.skip_output_check(); - let output = context - .new_command() - .args_vec(vec!["coverage".to_string(), format!("{}/", tempdir)]) - .run(); - - output.assert_exit_code(0); - output.assert_matches_text( - "---------------------------------- + { + let output = context + .new_command() + .args_vec(vec!["coverage".to_string(), format!("{}/", tempdir)]) + .run(); + + output.assert_exit_code(0); + output.assert_matches_text( + "---------------------------------- File | Branch % | Line % | ---------------------------------- bar.ts | 0.0 | 57.1 | @@ -565,7 +566,33 @@ File | Branch % | Line % | All files | 40.0 | 61.0 | ---------------------------------- ", - ); + ); + } + + // test --ignore flag works + { + let output = context + .new_command() + .args_vec(vec![ + "coverage".to_string(), + format!("{}/", tempdir), + "--ignore=**/bar.ts,**/quux.ts".to_string(), + ]) + .run(); + + output.assert_exit_code(0); + output.assert_matches_text( + "--------------------------------- +File | Branch % | Line % | +--------------------------------- + baz/qux.ts | 100.0 | 100.0 | + foo.ts | 50.0 | 76.9 | +--------------------------------- + All files | 66.7 | 85.0 | +--------------------------------- +", + ); + } } #[test] -- cgit v1.2.3