You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: disable ops and resources sanitizers by default in deno test (#33158)
## Summary
Changes the default for `sanitizeOps` and `sanitizeResources` from
`true` to `false` in `Deno.test()`. This aligns with what most users
expect -- tests no longer fail due to leaked async ops or resources
unless explicitly opted in.
### Before
```ts
// This test FAILS by default -- the timer leak triggers the ops sanitizer
Deno.test("my test", () => {
setTimeout(() => {}, 1000);
});
```
```
ERRORS
my test => ./main.ts:1:6
error: Leaks detected:
- A timer was started in this test, but never completed.
```
### After
```ts
// This test PASSES by default -- no sanitizers enabled
Deno.test("my test", () => {
setTimeout(() => {}, 1000);
});
```
To re-enable sanitizers, users have three options:
**1. CLI flags (e.g. for CI)**
```sh
deno test --sanitize-ops --sanitize-resources
```
**2. Environment variables (e.g. for CI)**
```sh
DENO_TEST_SANITIZE_OPS=1 DENO_TEST_SANITIZE_RESOURCES=1 deno test
```
**3. Per-test opt-in**
```ts
Deno.test({
name: "my test",
sanitizeOps: true,
sanitizeResources: true,
fn() {
setTimeout(() => {}, 1000);
},
});
```
### What's unchanged
- `sanitizeExit` default remains `true`
- Per-test `sanitizeOps: true` / `sanitizeResources: true` continues to
work
- Test steps still inherit sanitizer settings from their parent test
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 commit comments