Support a --nocapture
mode in the test runner.
#20835
Labels
suggestion
suggestions for new features (yet to be agreed)
testing
related to deno test and coverage
When you have a mix of Rust
println!
and JSconsole.log
output within a test the------- output -------
marker may be written in the middle of the output. I found this confusing and it made me incorrectly fear that I was seeing the output reordered.It may be worth adding a
--nocapture
mode similar to Rust's test runner which does not interfere with the output at all.Example adding a console.log before the call to abort in this test and running with http tracing:
Tracking this through the debugger it seems that there is no redirection of the process stdout/stderr within the thread. Instead when test creates a WebWorker it passes in a deno_io::Stdio which the worker then uses for its io. When console.log first writes to that Stdio::stdout/stderr it adds the marker. It doesn't see the process level stdout/stderr at all.
I'm not sure capturing the rust stdout is an options since it seems redirecting sdtout/stderr from within a process may potentially be problematic, see: https://stackoverflow.com/a/54432347. The gag crate linked there mentions an unstable function
std::io:set_print
which now seems to have been removed: rust-lang/rust#31343 (comment).Incidentally, it seems the test runner only hides when log level is
Some(level::Error)
, but the cli does not let you set this log level:Possibly worth looking into alongside with #20707.
The text was updated successfully, but these errors were encountered: