summaryrefslogtreecommitdiff
path: root/cli/lsp/testing/execution.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/lsp/testing/execution.rs')
-rw-r--r--cli/lsp/testing/execution.rs20
1 files changed, 8 insertions, 12 deletions
diff --git a/cli/lsp/testing/execution.rs b/cli/lsp/testing/execution.rs
index 77a326618..4f4862054 100644
--- a/cli/lsp/testing/execution.rs
+++ b/cli/lsp/testing/execution.rs
@@ -16,6 +16,7 @@ use crate::lsp::logging::lsp_log;
use crate::ops;
use crate::proc_state;
use crate::tools::test;
+use crate::tools::test::TestEventSender;
use deno_core::anyhow::anyhow;
use deno_core::error::AnyError;
@@ -180,21 +181,20 @@ async fn test_specifier(
permissions: Permissions,
specifier: ModuleSpecifier,
mode: test::TestMode,
- channel: mpsc::UnboundedSender<test::TestEvent>,
+ sender: TestEventSender,
token: CancellationToken,
options: Option<Value>,
) -> Result<(), AnyError> {
if !token.is_cancelled() {
- let (stdout, stderr) = test::create_stdout_stderr_pipes(channel.clone());
let mut worker = create_main_worker(
&ps,
specifier.clone(),
permissions,
- vec![ops::testing::init(channel.clone())],
+ vec![ops::testing::init(sender.clone())],
Stdio {
stdin: StdioPipe::Inherit,
- stdout: StdioPipe::File(stdout),
- stderr: StdioPipe::File(stderr),
+ stdout: StdioPipe::File(sender.stdout()),
+ stderr: StdioPipe::File(sender.stderr()),
},
);
@@ -318,6 +318,7 @@ impl TestRun {
.await?;
let (sender, mut receiver) = mpsc::unbounded_channel::<test::TestEvent>();
+ let sender = TestEventSender::new(sender);
let (concurrent_jobs, fail_fast) =
if let flags::DenoSubcommand::Test(test_flags) = &ps.flags.subcommand {
@@ -754,19 +755,14 @@ impl test::TestReporter for LspTestReporter {
self.progress(lsp_custom::TestRunProgressMessage::Started { test });
}
- fn report_output(&mut self, output: &test::TestOutput) {
+ fn report_output(&mut self, output: &[u8]) {
let test = self.current_origin.as_ref().and_then(|origin| {
self
.stack
.get(origin)
.and_then(|v| v.last().map(|td| td.into()))
});
- let value = match output {
- test::TestOutput::String(value) => value.replace('\n', "\r\n"),
- test::TestOutput::Bytes(bytes) => {
- String::from_utf8_lossy(bytes).replace('\n', "\r\n")
- }
- };
+ let value = String::from_utf8_lossy(output).replace('\n', "\r\n");
self.progress(lsp_custom::TestRunProgressMessage::Output {
value,