summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/build.rs57
-rw-r--r--cli/js/40_test.js11
-rw-r--r--cli/tools/test/fmt.rs2
3 files changed, 37 insertions, 33 deletions
diff --git a/cli/build.rs b/cli/build.rs
index 5fd6ca4d5..71751fb00 100644
--- a/cli/build.rs
+++ b/cli/build.rs
@@ -266,33 +266,36 @@ mod ts {
)
.unwrap();
- let output = create_snapshot(CreateSnapshotOptions {
- cargo_manifest_dir: env!("CARGO_MANIFEST_DIR"),
- snapshot_path,
- startup_snapshot: None,
- extensions: vec![deno_tsc::init_ops_and_esm(
- op_crate_libs,
- build_libs,
- path_dts,
- )],
- // NOTE(bartlomieju): Compressing the TSC snapshot in debug build took
- // ~45s on M1 MacBook Pro; without compression it took ~1s.
- // Thus we're not not using compressed snapshot, trading off
- // a lot of build time for some startup time in debug build.
- #[cfg(debug_assertions)]
- compression_cb: None,
-
- #[cfg(not(debug_assertions))]
- compression_cb: Some(Box::new(|vec, snapshot_slice| {
- eprintln!("Compressing TSC snapshot...");
- vec.extend_from_slice(
- &zstd::bulk::compress(snapshot_slice, 22)
- .expect("snapshot compression failed"),
- );
- })),
- with_runtime_cb: None,
- skip_op_registration: false,
- });
+ let output = create_snapshot(
+ CreateSnapshotOptions {
+ cargo_manifest_dir: env!("CARGO_MANIFEST_DIR"),
+ snapshot_path,
+ startup_snapshot: None,
+ extensions: vec![deno_tsc::init_ops_and_esm(
+ op_crate_libs,
+ build_libs,
+ path_dts,
+ )],
+ // NOTE(bartlomieju): Compressing the TSC snapshot in debug build took
+ // ~45s on M1 MacBook Pro; without compression it took ~1s.
+ // Thus we're not not using compressed snapshot, trading off
+ // a lot of build time for some startup time in debug build.
+ #[cfg(debug_assertions)]
+ compression_cb: None,
+
+ #[cfg(not(debug_assertions))]
+ compression_cb: Some(Box::new(|vec, snapshot_slice| {
+ eprintln!("Compressing TSC snapshot...");
+ vec.extend_from_slice(
+ &zstd::bulk::compress(snapshot_slice, 22)
+ .expect("snapshot compression failed"),
+ );
+ })),
+ with_runtime_cb: None,
+ skip_op_registration: false,
+ },
+ None,
+ );
for path in output.files_loaded_during_snapshot {
println!("cargo:rerun-if-changed={}", path.display());
}
diff --git a/cli/js/40_test.js b/cli/js/40_test.js
index b9735fc01..14adb5216 100644
--- a/cli/js/40_test.js
+++ b/cli/js/40_test.js
@@ -156,6 +156,7 @@ function populateOpNames() {
function assertOps(fn) {
/** @param desc {TestDescription | TestStepDescription} */
return async function asyncOpSanitizer(desc) {
+ let hasTraces = false;
if (opNames === null) populateOpNames();
const res = op_test_op_sanitizer_collect(
desc.id,
@@ -220,8 +221,7 @@ function assertOps(fn) {
message += ` This is often caused by not ${hint}.`;
}
const traces = [];
- for (const [id, { opName: traceOpName, stack }] of postTraces) {
- if (traceOpName !== opName) continue;
+ for (const [id, stack] of postTraces) {
if (MapPrototypeHas(preTraces, id)) continue;
ArrayPrototypePush(traces, stack);
}
@@ -232,6 +232,7 @@ function assertOps(fn) {
message += " The operations were started here:\n";
message += ArrayPrototypeJoin(traces, "\n\n");
}
+ hasTraces |= traces.length > 0;
ArrayPrototypePush(details, message);
} else if (diff < 0) {
const [name, hint] = op_test_op_sanitizer_get_async_message(opName);
@@ -247,8 +248,7 @@ function assertOps(fn) {
message += ` This is often caused by not ${hint}.`;
}
const traces = [];
- for (const [id, { opName: traceOpName, stack }] of preTraces) {
- if (opName !== traceOpName) continue;
+ for (const [id, stack] of preTraces) {
if (MapPrototypeHas(postTraces, id)) continue;
ArrayPrototypePush(traces, stack);
}
@@ -259,6 +259,7 @@ function assertOps(fn) {
message += " The operations were started here:\n";
message += ArrayPrototypeJoin(traces, "\n\n");
}
+ hasTraces |= traces.length > 0;
ArrayPrototypePush(details, message);
} else {
throw new Error("unreachable");
@@ -266,7 +267,7 @@ function assertOps(fn) {
}
return {
- failed: { leakedOps: [details, core.isOpCallTracingEnabled()] },
+ failed: { leakedOps: [details, hasTraces] },
};
};
}
diff --git a/cli/tools/test/fmt.rs b/cli/tools/test/fmt.rs
index 468b9d8f0..b0b37b5c4 100644
--- a/cli/tools/test/fmt.rs
+++ b/cli/tools/test/fmt.rs
@@ -133,7 +133,7 @@ fn format_sanitizer_accum_item(
) -> (RuntimeActivityType, Cow<'static, str>) {
let activity_type = activity.activity();
match activity {
- RuntimeActivity::AsyncOp(_, name) => (activity_type, name.into()),
+ RuntimeActivity::AsyncOp(_, name, _) => (activity_type, name.into()),
RuntimeActivity::Interval(_) => (activity_type, "".into()),
RuntimeActivity::Resource(_, name) => (activity_type, name.into()),
RuntimeActivity::Timer(_) => (activity_type, "".into()),