From 77b90f408c4244e8ee2e4b3bd26c441d4a250671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 21 Feb 2024 00:17:50 +0000 Subject: =?UTF-8?q?Revert=20"fix(console):=20support=20NO=5FCOLOR=20and=20?= =?UTF-8?q?colors=20option=20in=20all=20scena=E2=80=A6=20(#22507)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …rios (#21910)" This reverts commit bd1358efab8ba7339a8e70034315fa7da840292e. This change caused https://github.com/denoland/deno/issues/22496 and https://github.com/denoland/deno/issues/22445 --- tests/util/server/src/builders.rs | 26 ++++++-------------------- tests/util/server/src/lib.rs | 4 ---- 2 files changed, 6 insertions(+), 24 deletions(-) (limited to 'tests/util/server') diff --git a/tests/util/server/src/builders.rs b/tests/util/server/src/builders.rs index d8c209dd7..eb2014b8d 100644 --- a/tests/util/server/src/builders.rs +++ b/tests/util/server/src/builders.rs @@ -357,7 +357,6 @@ pub struct TestCommandBuilder { args_text: String, args_vec: Vec, split_output: bool, - skip_strip_ansi: bool, } impl TestCommandBuilder { @@ -369,7 +368,6 @@ impl TestCommandBuilder { stderr: None, stdin_text: None, split_output: false, - skip_strip_ansi: false, cwd: None, envs: Default::default(), envs_remove: Default::default(), @@ -453,11 +451,6 @@ impl TestCommandBuilder { self } - pub fn skip_strip_ansi(mut self) -> Self { - self.skip_strip_ansi = true; - self - } - pub fn stdin>(mut self, cfg: T) -> Self { self.stdin = Some(StdioContainer::new(cfg.into())); self @@ -581,14 +574,8 @@ impl TestCommandBuilder { output } - fn sanitize_output( - mut text: String, - args: &[OsString], - skip_strip_ansi: bool, - ) -> String { - if !skip_strip_ansi { - text = strip_ansi_codes(&text).to_string(); - } + fn sanitize_output(text: String, args: &[OsString]) -> String { + let mut text = strip_ansi_codes(&text).to_string(); // deno test's output capturing flushes with a zero-width space in order to // synchronize the output pipes. Occasionally this zero width space // might end up in the output so strip it from the output comparison here. @@ -635,15 +622,14 @@ impl TestCommandBuilder { // and dropping it closes them. drop(command); - let combined = combined_reader.map(|pipe| { - sanitize_output(read_pipe_to_string(pipe), &args, self.skip_strip_ansi) - }); + let combined = combined_reader + .map(|pipe| sanitize_output(read_pipe_to_string(pipe), &args)); let status = process.wait().unwrap(); let std_out_err = std_out_err_handle.map(|(stdout, stderr)| { ( - sanitize_output(stdout.join().unwrap(), &args, self.skip_strip_ansi), - sanitize_output(stderr.join().unwrap(), &args, self.skip_strip_ansi), + sanitize_output(stdout.join().unwrap(), &args), + sanitize_output(stderr.join().unwrap(), &args), ) }); let exit_code = status.code(); diff --git a/tests/util/server/src/lib.rs b/tests/util/server/src/lib.rs index 65dfe61ec..ead05641d 100644 --- a/tests/util/server/src/lib.rs +++ b/tests/util/server/src/lib.rs @@ -511,7 +511,6 @@ pub struct CheckOutputIntegrationTest<'a> { pub http_server: bool, pub envs: Vec<(String, String)>, pub env_clear: bool, - pub skip_strip_ansi: bool, pub temp_cwd: bool, /// Copies the files at the specified directory in the "testdata" directory /// to the temp folder and runs the test from there. This is useful when @@ -553,9 +552,6 @@ impl<'a> CheckOutputIntegrationTest<'a> { if self.env_clear { command_builder = command_builder.env_clear(); } - if self.skip_strip_ansi { - command_builder = command_builder.skip_strip_ansi(); - } if let Some(cwd) = &self.cwd { command_builder = command_builder.current_dir(cwd); } -- cgit v1.2.3