.Literfieber.
Denoβ€’3y agoβ€’
6 replies
.Literfieber

Deno test Leaking resources

Hi i currently try to get used to deno.test but Deno.readTextFile makes the test end in the following error:
error: Leaking resources:
  - A file (rid 3) was opened during the test, but not closed during the test. Close the file handle by calling `file.close()`.


My function looks like this:
export async function test() {
    try {
        const test = await Deno.readTextFile("./test.txt");
        return true
    }
    catch (err) {
        log(err);
        return false;
    }
}

Is there a way to close the file so that i don't get the error ?
Was this page helpful?