-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to ignore file leaks with deno test #27454
Comments
You can disable resource leak detection by passing https://docs.deno.com/runtime/fundamentals/testing/#resource-sanitizer Deno.test("my test", { sanitizeResources: false }, async () => {
const file = await Deno.open("README.md");
// now it's fine to leave the file open
}); |
Hey @kt3k, |
Yes, you can pass import { describe, it } from "jsr:@std/testing/bdd";
describe("foo", { sanitizeResources: false }, () => {
it("bar", async () => {
const file = await Deno.open("README.md");
});
}); Alternatively, there's unstable API for disabling leak detection for the entire file: import { describe, it } from "jsr:@std/testing/bdd";
import { configureGlobalSanitizers } from "jsr:@std/testing/unstable-bdd";
configureGlobalSanitizers({
sanitizeResources: false,
});
describe("foo", () => {
it("bar", async () => {
const file = await Deno.open("README.md");
});
}); This might look cleaner if there's many test cases in a single file. FYI there's also a similar option |
@abdurahmanshiine Does |
Hey guys,
I keep getting this error
The issue is it's not telling me which file it is, or which file object it's referring to, so I was wondering how can I disable leaks tracing in testing, I honestly don't even need that at this point.
Version: Deno 2.1.4
The text was updated successfully, but these errors were encountered: