diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-02-25 16:14:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-25 16:14:46 +0100 |
commit | d332bf113259f65e90b18b543f19def248e38daa (patch) | |
tree | ed842487aa4f903d50bbb45d8ed2b5292257eda7 /cli/tools/test.rs | |
parent | 111c343281b559ea51fd66c2ddc260549406a822 (diff) |
feat: deno test --trace-ops (#13770)
This commit adds "--trace-ops" flag to "deno test" subcommand.
This flag enables saving of stack traces for async ops, that before were always
saved. While the feature proved to be very useful it comes with a significant performance
hit, it's caused by excessive source mapping of stack frames.
Diffstat (limited to 'cli/tools/test.rs')
-rw-r--r-- | cli/tools/test.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/cli/tools/test.rs b/cli/tools/test.rs index 97a7ddf4f..2a43e3813 100644 --- a/cli/tools/test.rs +++ b/cli/tools/test.rs @@ -158,6 +158,7 @@ struct TestSpecifierOptions { fail_fast: Option<NonZeroUsize>, filter: Option<String>, shuffle: Option<u64>, + trace_ops: bool, } impl TestSummary { @@ -477,9 +478,14 @@ async fn test_specifier( // Enable op call tracing in core to enable better debugging of op sanitizer // failures. - worker - .execute_script(&located_script_name!(), "Deno.core.enableOpCallTracing();") - .unwrap(); + if options.trace_ops { + worker + .execute_script( + &located_script_name!(), + "Deno.core.enableOpCallTracing();", + ) + .unwrap(); + } // We only execute the specifier as a module if it is tagged with TestMode::Module or // TestMode::Both. @@ -1043,6 +1049,7 @@ pub async fn run_tests( fail_fast: test_flags.fail_fast, filter: test_flags.filter, shuffle: test_flags.shuffle, + trace_ops: test_flags.trace_ops, }, ) .await?; @@ -1277,6 +1284,7 @@ pub async fn run_tests_with_watch( fail_fast: test_flags.fail_fast, filter: filter.clone(), shuffle: test_flags.shuffle, + trace_ops: test_flags.trace_ops, }, ) .await?; |