diff options
author | Speykious <speykious.the.king@gmail.com> | 2020-05-19 20:19:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-19 14:19:26 -0400 |
commit | 9752b853ddac3ba41378d0ae8a8604a28e285ffb (patch) | |
tree | 1082dc9786adf3dbbda04b39b67ff3f421a6736f /cli/tests | |
parent | cdc9323cccdee544562712018f722026bdfbbd6c (diff) |
Provide better ANSI colorized output when inspecting objects (#5404)
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/integration_tests.rs | 30 | ||||
-rw-r--r-- | cli/tests/seed_random.js.out | 16 |
2 files changed, 26 insertions, 20 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 45c3a011f..103e3142e 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -80,7 +80,7 @@ fn no_color() { .unwrap(); assert!(output.status.success()); let stdout_str = std::str::from_utf8(&output.stdout).unwrap().trim(); - assert_eq!("noColor false", stdout_str); + assert_eq!("noColor false", util::strip_ansi_codes(stdout_str)); } // TODO re-enable. This hangs on macOS @@ -403,6 +403,7 @@ fn js_unit_tests() { .arg("cli/js/tests/unit_test_runner.ts") .arg("--master") .arg("--verbose") + .env("NO_COLOR", "1") .spawn() .expect("failed to spawn script"); let status = deno.wait().expect("failed to wait for the child process"); @@ -672,7 +673,7 @@ fn repl_test_console_log() { true, "repl", Some(vec!["console.log('hello')", "'world'"]), - None, + Some(vec![("NO_COLOR".to_owned(), "1".to_owned())]), false, ); assert!(out.ends_with("hello\nundefined\nworld\n")); @@ -685,7 +686,7 @@ fn repl_test_eof() { true, "repl", Some(vec!["1 + 2"]), - None, + Some(vec![("NO_COLOR".to_owned(), "1".to_owned())]), false, ); assert!(out.ends_with("3\n")); @@ -714,7 +715,7 @@ fn repl_test_function() { true, "repl", Some(vec!["Deno.writeFileSync"]), - None, + Some(vec![("NO_COLOR".to_owned(), "1".to_owned())]), false, ); assert!(out.ends_with("[Function: writeFileSync]\n")); @@ -727,7 +728,7 @@ fn repl_test_multiline() { true, "repl", Some(vec!["(\n1 + 2\n)"]), - None, + Some(vec![("NO_COLOR".to_owned(), "1".to_owned())]), false, ); assert!(out.ends_with("3\n")); @@ -792,7 +793,7 @@ fn repl_test_variable() { true, "repl", Some(vec!["var a = 123;", "a"]), - None, + Some(vec![("NO_COLOR".to_owned(), "1".to_owned())]), false, ); assert!(out.ends_with("undefined\n123\n")); @@ -805,7 +806,7 @@ fn repl_test_lexical_scoped_variable() { true, "repl", Some(vec!["let a = 123;", "a"]), - None, + Some(vec![("NO_COLOR".to_owned(), "1".to_owned())]), false, ); assert!(out.ends_with("undefined\n123\n")); @@ -822,7 +823,10 @@ fn repl_test_missing_deno_dir() { true, "repl", Some(vec!["1"]), - Some(vec![("DENO_DIR".to_owned(), DENO_DIR.to_owned())]), + Some(vec![ + ("DENO_DIR".to_owned(), DENO_DIR.to_owned()), + ("NO_COLOR".to_owned(), "1".to_owned()), + ]), false, ); assert!(read_dir(&test_deno_dir).is_ok()); @@ -837,7 +841,7 @@ fn repl_test_save_last_eval() { true, "repl", Some(vec!["1", "_"]), - None, + Some(vec![("NO_COLOR".to_owned(), "1".to_owned())]), false, ); assert!(out.ends_with("1\n1\n")); @@ -850,7 +854,7 @@ fn repl_test_save_last_thrown() { true, "repl", Some(vec!["throw 1", "_error"]), - None, + Some(vec![("NO_COLOR".to_owned(), "1".to_owned())]), false, ); assert!(out.ends_with("1\n")); @@ -863,7 +867,7 @@ fn repl_test_assign_underscore() { true, "repl", Some(vec!["_ = 1", "2", "_"]), - None, + Some(vec![("NO_COLOR".to_owned(), "1".to_owned())]), false, ); assert!( @@ -878,7 +882,7 @@ fn repl_test_assign_underscore_error() { true, "repl", Some(vec!["_error = 1", "throw 2", "_error"]), - None, + Some(vec![("NO_COLOR".to_owned(), "1".to_owned())]), false, ); assert!( @@ -1535,6 +1539,7 @@ itest!(lib_runtime_api { itest!(seed_random { args: "run --seed=100 seed_random.js", + output: "seed_random.js.out", }); @@ -2370,6 +2375,7 @@ async fn inspector_does_not_hang() { // Warning: each inspector test should be on its own port to avoid // conflicting with another inspector test. .arg("--inspect-brk=127.0.0.1:9232") + .env("NO_COLOR", "1") .arg(script) .stdout(std::process::Stdio::piped()) .stderr(std::process::Stdio::piped()) diff --git a/cli/tests/seed_random.js.out b/cli/tests/seed_random.js.out index 2b5551c83..f51b858ff 100644 --- a/cli/tests/seed_random.js.out +++ b/cli/tests/seed_random.js.out @@ -9,15 +9,15 @@ 0.5950178237266042 0.22440633214343908 Uint8Array(32) [ - 116, 125, 169, 69, 106, 231, 99, - 39, 148, 188, 211, 41, 46, 211, - 236, 141, 55, 10, 214, 63, 118, + 116, 125, 169, 69, 106, 231, 99, + 39, 148, 188, 211, 41, 46, 211, + 236, 141, 55, 10, 214, 63, 118, 230, 218, 249, 125, 161, 137, 110, - 214, 36, 159, 154 + 214, 36, 159, 154 ] Uint8Array(32) [ - 248, 21, 21, 9, 41, 0, 71, 124, - 244, 209, 252, 151, 7, 10, 168, 250, - 84, 170, 243, 140, 53, 47, 99, 212, - 18, 146, 68, 48, 66, 222, 67, 112 + 248, 21, 21, 9, 41, 0, 71, 124, + 244, 209, 252, 151, 7, 10, 168, 250, + 84, 170, 243, 140, 53, 47, 99, 212, + 18, 146, 68, 48, 66, 222, 67, 112 ] |