summaryrefslogtreecommitdiff
path: root/core/lib.deno_core.d.ts
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2022-02-16 19:53:17 +0100
committerGitHub <noreply@github.com>2022-02-16 19:53:17 +0100
commit53088e16de9728696df12b04670a0f2d5203592b (patch)
tree74df68fc3f39db638db6431580d03c235a8f5ff4 /core/lib.deno_core.d.ts
parentb98afb59ae43b4fcfc2bf06e82942005d7f68c7b (diff)
feat(test): improved op sanitizer errors + traces (#13676)
This commit improves the error messages for the `deno test` async op sanitizer. It does this in two ways: - it uses handwritten error messages for each op that could be leaking - it includes traces showing where each op was started This "async op tracing" functionality is a new feature in deno_core. It likely has a significant performance impact, which is why it is only enabled in tests.
Diffstat (limited to 'core/lib.deno_core.d.ts')
-rw-r--r--core/lib.deno_core.d.ts23
1 files changed, 23 insertions, 0 deletions
diff --git a/core/lib.deno_core.d.ts b/core/lib.deno_core.d.ts
index 9f554f12b..37cd33190 100644
--- a/core/lib.deno_core.d.ts
+++ b/core/lib.deno_core.d.ts
@@ -141,5 +141,28 @@ declare namespace Deno {
): undefined | UncaughtExceptionCallback;
export type UncaughtExceptionCallback = (err: any) => void;
+
+ /**
+ * Enables collection of stack traces of all async ops. This allows for
+ * debugging of where a given async op was started. Deno CLI uses this for
+ * improving error message in op sanitizer errors for `deno test`.
+ *
+ * **NOTE:** enabling tracing has a significant negative performance impact.
+ * To get high level metrics on async ops with no added performance cost,
+ * use `Deno.core.metrics()`.
+ */
+ function enableOpCallTracing(): void;
+
+ export interface OpCallTrace {
+ opName: string;
+ stack: string;
+ }
+
+ /**
+ * A map containing traces for all ongoing async ops. The key is the op id.
+ * Tracing only occurs when `Deno.core.enableOpCallTracing()` was previously
+ * enabled.
+ */
+ const opCallTraces: Map<number, OpCallTrace>;
}
}