summaryrefslogtreecommitdiff
path: root/cli/tests/integration/coverage_tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/integration/coverage_tests.rs')
-rw-r--r--cli/tests/integration/coverage_tests.rs61
1 files changed, 58 insertions, 3 deletions
diff --git a/cli/tests/integration/coverage_tests.rs b/cli/tests/integration/coverage_tests.rs
index d3affd4de..4d927a16d 100644
--- a/cli/tests/integration/coverage_tests.rs
+++ b/cli/tests/integration/coverage_tests.rs
@@ -115,7 +115,11 @@ fn run_coverage_text(test_name: &str, extension: &str) {
let output = context
.new_command()
- .args_vec(vec!["coverage".to_string(), format!("{}/", tempdir)])
+ .args_vec(vec![
+ "coverage".to_string(),
+ "--pretty".to_string(),
+ format!("{}/", tempdir),
+ ])
.split_output()
.run();
@@ -184,7 +188,11 @@ fn multifile_coverage() {
let output = context
.new_command()
- .args_vec(vec!["coverage".to_string(), format!("{}/", tempdir)])
+ .args_vec(vec![
+ "coverage".to_string(),
+ "--pretty".to_string(),
+ format!("{}/", tempdir),
+ ])
.split_output()
.run();
@@ -255,6 +263,7 @@ fn no_snaps_included(test_name: &str, extension: &str) {
.args_vec(vec![
"coverage".to_string(),
"--include=no_snaps_included.ts".to_string(),
+ "--pretty".to_string(),
format!("{}/", tempdir),
])
.split_output()
@@ -303,6 +312,7 @@ fn no_tests_included(test_name: &str, extension: &str) {
.args_vec(vec![
"coverage".to_string(),
format!("--exclude={}", util::std_path().canonicalize()),
+ "--pretty".to_string(),
format!("{}/", tempdir),
])
.split_output()
@@ -350,7 +360,11 @@ fn no_npm_cache_coverage() {
let output = context
.new_command()
- .args_vec(vec!["coverage".to_string(), format!("{}/", tempdir)])
+ .args_vec(vec![
+ "coverage".to_string(),
+ "--pretty".to_string(),
+ format!("{}/", tempdir),
+ ])
.split_output()
.run();
@@ -397,6 +411,7 @@ fn no_transpiled_lines() {
.args_vec(vec![
"coverage".to_string(),
"--include=no_transpiled_lines/index.ts".to_string(),
+ "--pretty".to_string(),
format!("{}/", tempdir),
])
.run();
@@ -575,3 +590,43 @@ fn test_html_reporter() {
.unwrap();
assert!(baz_quux_ts_html.contains("<h1>Coverage report for baz/quux.ts</h1>"));
}
+
+#[test]
+fn test_summary_reporter() {
+ let context = TestContext::default();
+ let tempdir = context.temp_dir();
+ let tempdir = tempdir.path().join("cov");
+
+ let output = context
+ .new_command()
+ .args_vec(vec![
+ "test".to_string(),
+ "--quiet".to_string(),
+ format!("--coverage={}", tempdir),
+ "coverage/multisource".to_string(),
+ ])
+ .run();
+
+ 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(
+ "----------------------------------
+File | Branch % | Line % |
+----------------------------------
+ bar.ts | 0.0 | 57.1 |
+ baz/quux.ts | 0.0 | 28.6 |
+ baz/qux.ts | 100.0 | 100.0 |
+ foo.ts | 50.0 | 76.9 |
+----------------------------------
+ All files | 40.0 | 61.0 |
+----------------------------------
+",
+ );
+}