From 345a5b3dff3a333d156bf4aff9f7e2a355d59746 Mon Sep 17 00:00:00 2001 From: uki00a Date: Fri, 19 Jun 2020 19:10:31 +0900 Subject: fix: "deno test" should respect NO_COLOR=true (#6371) --- cli/tests/deno_test_no_color.ts | 17 +++++++++++++++++ cli/tests/integration_tests.rs | 16 ++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 cli/tests/deno_test_no_color.ts (limited to 'cli/tests') diff --git a/cli/tests/deno_test_no_color.ts b/cli/tests/deno_test_no_color.ts new file mode 100644 index 000000000..38c531ee9 --- /dev/null +++ b/cli/tests/deno_test_no_color.ts @@ -0,0 +1,17 @@ +Deno.test({ + name: "success", + fn() {}, +}); + +Deno.test({ + name: "fail", + fn() { + throw new Error("fail"); + }, +}); + +Deno.test({ + name: "ignored", + ignore: true, + fn() {}, +}); diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index cbd0dbc26..78a89eb2b 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -1119,6 +1119,22 @@ fn repl_test_assign_underscore_error() { assert_eq!(err, "Thrown: 2\n"); } +#[test] +fn deno_test_no_color() { + let (out, _) = util::run_and_collect_output( + false, + "test deno_test_no_color.ts", + None, + Some(vec![("NO_COLOR".to_owned(), "true".to_owned())]), + false, + ); + // ANSI escape codes should be stripped. + assert!(out.contains("test success ... ok")); + assert!(out.contains("test fail ... FAILED")); + assert!(out.contains("test ignored ... ignored")); + assert!(out.contains("test result: FAILED. 1 passed; 1 failed; 1 ignored; 0 measured; 0 filtered out")); +} + #[test] fn util_test() { util::run_python_script("tools/util_test.py") -- cgit v1.2.3