1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-28 16:20:57 -05:00

feat: deprecate Deno.resources() (#22059)

Most uses of `Deno.resources()` within tests, as they previously checked
for leaked resources. This is not needed as the test runner does this
automatically. Other internal uses of this API have been replaced with
the internal `Deno[Deno.internal].core.resources()`.
This commit is contained in:
Asher Gomez 2024-01-24 10:27:29 +11:00 committed by GitHub
parent 4eedac3604
commit 947ce41e99
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 32 additions and 111 deletions

View file

@ -1,6 +1,6 @@
async function doAFetch() { async function doAFetch() {
const resp = await fetch("http://localhost:4545/README.md"); const resp = await fetch("http://localhost:4545/README.md");
console.log(Deno.resources()); // print the current resources console.log(Deno[Deno.internal].core.resources()); // print the current resources
const _resp = resp; const _resp = resp;
// at this point resp can be GC'ed // at this point resp can be GC'ed
} }
@ -13,4 +13,4 @@ globalThis.gc(); // force GC
// the response body is not called and the resource is not closed. // the response body is not called and the resource is not closed.
await new Promise((resolve) => setTimeout(resolve, 0)); await new Promise((resolve) => setTimeout(resolve, 0));
console.log(Deno.resources()); // print the current resources console.log(Deno[Deno.internal].core.resources()); // print the current resources

View file

@ -1084,6 +1084,9 @@ Deno.test(
); );
// https://github.com/denoland/deno/issues/11926 // https://github.com/denoland/deno/issues/11926
// verify that the only new resource is "httpConnection", to make
// sure "request" resource is closed even if its body was not read
// by server handler
Deno.test( Deno.test(
{ permissions: { net: true } }, { permissions: { net: true } },
async function httpServerDoesntLeakResources2() { async function httpServerDoesntLeakResources2() {
@ -1105,22 +1108,11 @@ Deno.test(
} }
})(); })();
const resourcesBefore = Deno.resources();
const response = await fetch(`http://127.0.0.1:${listenPort}`, { const response = await fetch(`http://127.0.0.1:${listenPort}`, {
method: "POST", method: "POST",
body: "hello world", body: "hello world",
}); });
await response.text(); await response.text();
const resourcesAfter = Deno.resources();
// verify that the only new resource is "httpConnection", to make
// sure "request" resource is closed even if its body was not read
// by server handler
for (const rid of Object.keys(resourcesBefore)) {
delete resourcesAfter[Number(rid)];
}
assertEquals(Object.keys(resourcesAfter).length, 1);
listener!.close(); listener!.close();
httpConn!.close(); httpConn!.close();

View file

@ -75,18 +75,14 @@ Deno.test({ permissions: { read: true } }, function readFileSyncLoop() {
Deno.test( Deno.test(
{ permissions: { read: true } }, { permissions: { read: true } },
async function readFileDoesNotLeakResources() { async function readFileDoesNotLeakResources() {
const resourcesBefore = Deno.resources();
await assertRejects(async () => await Deno.readFile("cli")); await assertRejects(async () => await Deno.readFile("cli"));
assertEquals(resourcesBefore, Deno.resources());
}, },
); );
Deno.test( Deno.test(
{ permissions: { read: true } }, { permissions: { read: true } },
function readFileSyncDoesNotLeakResources() { function readFileSyncDoesNotLeakResources() {
const resourcesBefore = Deno.resources();
assertThrows(() => Deno.readFileSync("cli")); assertThrows(() => Deno.readFileSync("cli"));
assertEquals(resourcesBefore, Deno.resources());
}, },
); );

View file

@ -73,18 +73,14 @@ Deno.test({ permissions: { read: true } }, function readTextFileSyncLoop() {
Deno.test( Deno.test(
{ permissions: { read: true } }, { permissions: { read: true } },
async function readTextFileDoesNotLeakResources() { async function readTextFileDoesNotLeakResources() {
const resourcesBefore = Deno.resources();
await assertRejects(async () => await Deno.readTextFile("cli")); await assertRejects(async () => await Deno.readTextFile("cli"));
assertEquals(resourcesBefore, Deno.resources());
}, },
); );
Deno.test( Deno.test(
{ permissions: { read: true } }, { permissions: { read: true } },
function readTextFileSyncDoesNotLeakResources() { function readTextFileSyncDoesNotLeakResources() {
const resourcesBefore = Deno.resources();
assertThrows(() => Deno.readTextFileSync("cli")); assertThrows(() => Deno.readTextFileSync("cli"));
assertEquals(resourcesBefore, Deno.resources());
}, },
); );

View file

@ -97,7 +97,6 @@ Deno.test({
Deno.test({ Deno.test({
name: "Async: Data is written to passed in file path", name: "Async: Data is written to passed in file path",
async fn() { async fn() {
const openResourcesBeforeAppend: Deno.ResourceMap = Deno.resources();
await new Promise<void>((resolve, reject) => { await new Promise<void>((resolve, reject) => {
appendFile("_fs_appendFile_test_file.txt", "hello world", (err) => { appendFile("_fs_appendFile_test_file.txt", "hello world", (err) => {
if (err) reject(err); if (err) reject(err);
@ -105,7 +104,6 @@ Deno.test({
}); });
}) })
.then(async () => { .then(async () => {
assertEquals(Deno.resources(), openResourcesBeforeAppend);
const data = await Deno.readFile("_fs_appendFile_test_file.txt"); const data = await Deno.readFile("_fs_appendFile_test_file.txt");
assertEquals(decoder.decode(data), "hello world"); assertEquals(decoder.decode(data), "hello world");
}, (err) => { }, (err) => {
@ -120,7 +118,6 @@ Deno.test({
Deno.test({ Deno.test({
name: "Async: Data is written to passed in URL", name: "Async: Data is written to passed in URL",
async fn() { async fn() {
const openResourcesBeforeAppend: Deno.ResourceMap = Deno.resources();
const fileURL = new URL("_fs_appendFile_test_file.txt", import.meta.url); const fileURL = new URL("_fs_appendFile_test_file.txt", import.meta.url);
await new Promise<void>((resolve, reject) => { await new Promise<void>((resolve, reject) => {
appendFile(fileURL, "hello world", (err) => { appendFile(fileURL, "hello world", (err) => {
@ -129,7 +126,6 @@ Deno.test({
}); });
}) })
.then(async () => { .then(async () => {
assertEquals(Deno.resources(), openResourcesBeforeAppend);
const data = await Deno.readFile(fromFileUrl(fileURL)); const data = await Deno.readFile(fromFileUrl(fileURL));
assertEquals(decoder.decode(data), "hello world"); assertEquals(decoder.decode(data), "hello world");
}, (err) => { }, (err) => {
@ -145,7 +141,6 @@ Deno.test({
name: name:
"Async: Callback is made with error if attempting to append data to an existing file with 'ax' flag", "Async: Callback is made with error if attempting to append data to an existing file with 'ax' flag",
async fn() { async fn() {
const openResourcesBeforeAppend: Deno.ResourceMap = Deno.resources();
const tempFile: string = await Deno.makeTempFile(); const tempFile: string = await Deno.makeTempFile();
await new Promise<void>((resolve, reject) => { await new Promise<void>((resolve, reject) => {
appendFile(tempFile, "hello world", { flag: "ax" }, (err) => { appendFile(tempFile, "hello world", { flag: "ax" }, (err) => {
@ -153,11 +148,8 @@ Deno.test({
else resolve(); else resolve();
}); });
}) })
.then(() => { .then(() => fail("Expected error to be thrown"))
fail("Expected error to be thrown"); .catch(() => {})
}, () => {
assertEquals(Deno.resources(), openResourcesBeforeAppend);
})
.finally(async () => { .finally(async () => {
await Deno.remove(tempFile); await Deno.remove(tempFile);
}); });
@ -184,9 +176,7 @@ Deno.test({
Deno.test({ Deno.test({
name: "Sync: Data is written to passed in file path", name: "Sync: Data is written to passed in file path",
fn() { fn() {
const openResourcesBeforeAppend: Deno.ResourceMap = Deno.resources();
appendFileSync("_fs_appendFile_test_file_sync.txt", "hello world"); appendFileSync("_fs_appendFile_test_file_sync.txt", "hello world");
assertEquals(Deno.resources(), openResourcesBeforeAppend);
const data = Deno.readFileSync("_fs_appendFile_test_file_sync.txt"); const data = Deno.readFileSync("_fs_appendFile_test_file_sync.txt");
assertEquals(decoder.decode(data), "hello world"); assertEquals(decoder.decode(data), "hello world");
Deno.removeSync("_fs_appendFile_test_file_sync.txt"); Deno.removeSync("_fs_appendFile_test_file_sync.txt");
@ -197,14 +187,12 @@ Deno.test({
name: name:
"Sync: error thrown if attempting to append data to an existing file with 'ax' flag", "Sync: error thrown if attempting to append data to an existing file with 'ax' flag",
fn() { fn() {
const openResourcesBeforeAppend: Deno.ResourceMap = Deno.resources();
const tempFile: string = Deno.makeTempFileSync(); const tempFile: string = Deno.makeTempFileSync();
assertThrows( assertThrows(
() => appendFileSync(tempFile, "hello world", { flag: "ax" }), () => appendFileSync(tempFile, "hello world", { flag: "ax" }),
Error, Error,
"", "",
); );
assertEquals(Deno.resources(), openResourcesBeforeAppend);
Deno.removeSync(tempFile); Deno.removeSync(tempFile);
}, },
}); });
@ -212,10 +200,8 @@ Deno.test({
Deno.test({ Deno.test({
name: "Sync: Data is written in Uint8Array to passed in file path", name: "Sync: Data is written in Uint8Array to passed in file path",
fn() { fn() {
const openResourcesBeforeAppend: Deno.ResourceMap = Deno.resources();
const testData = new TextEncoder().encode("hello world"); const testData = new TextEncoder().encode("hello world");
appendFileSync("_fs_appendFile_test_file_sync.txt", testData); appendFileSync("_fs_appendFile_test_file_sync.txt", testData);
assertEquals(Deno.resources(), openResourcesBeforeAppend);
const data = Deno.readFileSync("_fs_appendFile_test_file_sync.txt"); const data = Deno.readFileSync("_fs_appendFile_test_file_sync.txt");
assertEquals(data, testData); assertEquals(data, testData);
Deno.removeSync("_fs_appendFile_test_file_sync.txt"); Deno.removeSync("_fs_appendFile_test_file_sync.txt");
@ -225,7 +211,6 @@ Deno.test({
Deno.test({ Deno.test({
name: "Async: Data is written in Uint8Array to passed in file path", name: "Async: Data is written in Uint8Array to passed in file path",
async fn() { async fn() {
const openResourcesBeforeAppend: Deno.ResourceMap = Deno.resources();
const testData = new TextEncoder().encode("hello world"); const testData = new TextEncoder().encode("hello world");
await new Promise<void>((resolve, reject) => { await new Promise<void>((resolve, reject) => {
appendFile("_fs_appendFile_test_file.txt", testData, (err) => { appendFile("_fs_appendFile_test_file.txt", testData, (err) => {
@ -234,7 +219,6 @@ Deno.test({
}); });
}) })
.then(async () => { .then(async () => {
assertEquals(Deno.resources(), openResourcesBeforeAppend);
const data = await Deno.readFile("_fs_appendFile_test_file.txt"); const data = await Deno.readFile("_fs_appendFile_test_file.txt");
assertEquals(data, testData); assertEquals(data, testData);
}, (err) => { }, (err) => {

View file

@ -13,18 +13,13 @@ Deno.test({
const tempFile: string = await Deno.makeTempFile(); const tempFile: string = await Deno.makeTempFile();
const file: Deno.FsFile = await Deno.open(tempFile); const file: Deno.FsFile = await Deno.open(tempFile);
assert(Deno.resources()[file.rid]);
await new Promise<void>((resolve, reject) => { await new Promise<void>((resolve, reject) => {
close(file.rid, (err) => { close(file.rid, (err) => {
if (err !== null) reject(); if (err !== null) reject();
else resolve(); else resolve();
}); });
}) })
.then(() => { .catch(() => fail("No error expected"))
assert(!Deno.resources()[file.rid]);
}, () => {
fail("No error expected");
})
.finally(async () => { .finally(async () => {
await Deno.remove(tempFile); await Deno.remove(tempFile);
}); });
@ -66,9 +61,7 @@ Deno.test({
const tempFile: string = Deno.makeTempFileSync(); const tempFile: string = Deno.makeTempFileSync();
const file: Deno.FsFile = Deno.openSync(tempFile); const file: Deno.FsFile = Deno.openSync(tempFile);
assert(Deno.resources()[file.rid]);
closeSync(file.rid); closeSync(file.rid);
assert(!Deno.resources()[file.rid]);
Deno.removeSync(tempFile); Deno.removeSync(tempFile);
}, },
}); });

View file

@ -10,7 +10,6 @@ import {
O_WRONLY, O_WRONLY,
} from "node:constants"; } from "node:constants";
import { import {
assert,
assertEquals, assertEquals,
assertThrows, assertThrows,
fail, fail,
@ -35,7 +34,6 @@ Deno.test({
}) })
.then((fd) => { .then((fd) => {
fd1 = fd; fd1 = fd;
assert(Deno.resources()[fd], `${fd}`);
}, () => fail()) }, () => fail())
.finally(() => closeSync(fd1)); .finally(() => closeSync(fd1));
}, },
@ -46,7 +44,6 @@ Deno.test({
fn() { fn() {
const file = Deno.makeTempFileSync(); const file = Deno.makeTempFileSync();
const fd = openSync(file, "r"); const fd = openSync(file, "r");
assert(Deno.resources()[fd]);
closeSync(fd); closeSync(fd);
}, },
}); });
@ -58,7 +55,6 @@ Deno.test({
const fd = openSync(file, "a"); const fd = openSync(file, "a");
assertEquals(typeof fd, "number"); assertEquals(typeof fd, "number");
assertEquals(existsSync(file), true); assertEquals(existsSync(file), true);
assert(Deno.resources()[fd]);
closeSync(fd); closeSync(fd);
}, },
}); });
@ -225,7 +221,6 @@ Deno.test({
const fd = openSync(file, O_APPEND | O_CREAT | O_WRONLY); const fd = openSync(file, O_APPEND | O_CREAT | O_WRONLY);
assertEquals(typeof fd, "number"); assertEquals(typeof fd, "number");
assertEquals(existsSync(file), true); assertEquals(existsSync(file), true);
assert(Deno.resources()[fd]);
closeSync(fd); closeSync(fd);
}, },
}); });
@ -403,7 +398,6 @@ Deno.test("[std/node/fs] open callback isn't called twice if error is thrown", a
fn() { fn() {
const file = Deno.makeTempFileSync(); const file = Deno.makeTempFileSync();
const fd = openSync(file, 0); const fd = openSync(file, 0);
assert(Deno.resources()[fd]);
closeSync(fd); closeSync(fd);
}, },
}); });

View file

@ -6,7 +6,7 @@ import {
fail, fail,
} from "../../../../test_util/std/assert/mod.ts"; } from "../../../../test_util/std/assert/mod.ts";
import { rm, rmSync } from "node:fs"; import { rm, rmSync } from "node:fs";
import { closeSync, existsSync } from "node:fs"; import { existsSync } from "node:fs";
import { join } from "../../../../test_util/std/path/mod.ts"; import { join } from "../../../../test_util/std/path/mod.ts";
Deno.test({ Deno.test({
@ -26,27 +26,14 @@ Deno.test({
}, },
}); });
function closeRes(before: Deno.ResourceMap, after: Deno.ResourceMap) {
for (const key in after) {
if (!before[key]) {
try {
closeSync(Number(key));
} catch (error) {
return error;
}
}
}
}
Deno.test({ Deno.test({
name: "ASYNC: removing non-empty folder", name: "ASYNC: removing non-empty folder",
async fn() { async fn() {
const rBefore = Deno.resources();
const dir = Deno.makeTempDirSync(); const dir = Deno.makeTempDirSync();
Deno.createSync(join(dir, "file1.txt")); using _file1 = Deno.createSync(join(dir, "file1.txt"));
Deno.createSync(join(dir, "file2.txt")); using _file2 = Deno.createSync(join(dir, "file2.txt"));
Deno.mkdirSync(join(dir, "some_dir")); Deno.mkdirSync(join(dir, "some_dir"));
Deno.createSync(join(dir, "some_dir", "file.txt")); using _file = Deno.createSync(join(dir, "some_dir", "file.txt"));
await new Promise<void>((resolve, reject) => { await new Promise<void>((resolve, reject) => {
rm(dir, { recursive: true }, (err) => { rm(dir, { recursive: true }, (err) => {
if (err) reject(err); if (err) reject(err);
@ -56,8 +43,6 @@ Deno.test({
.then(() => assertEquals(existsSync(dir), false), () => fail()) .then(() => assertEquals(existsSync(dir), false), () => fail())
.finally(() => { .finally(() => {
if (existsSync(dir)) Deno.removeSync(dir, { recursive: true }); if (existsSync(dir)) Deno.removeSync(dir, { recursive: true });
const rAfter = Deno.resources();
closeRes(rBefore, rAfter);
}); });
}, },
ignore: Deno.build.os === "windows", ignore: Deno.build.os === "windows",
@ -116,17 +101,13 @@ Deno.test({
Deno.test({ Deno.test({
name: "SYNC: removing non-empty folder", name: "SYNC: removing non-empty folder",
fn() { fn() {
const rBefore = Deno.resources();
const dir = Deno.makeTempDirSync(); const dir = Deno.makeTempDirSync();
Deno.createSync(join(dir, "file1.txt")); using _file1 = Deno.createSync(join(dir, "file1.txt"));
Deno.createSync(join(dir, "file2.txt")); using _file2 = Deno.createSync(join(dir, "file2.txt"));
Deno.mkdirSync(join(dir, "some_dir")); Deno.mkdirSync(join(dir, "some_dir"));
Deno.createSync(join(dir, "some_dir", "file.txt")); using _file = Deno.createSync(join(dir, "some_dir", "file.txt"));
rmSync(dir, { recursive: true }); rmSync(dir, { recursive: true });
assertEquals(existsSync(dir), false); assertEquals(existsSync(dir), false);
// closing resources
const rAfter = Deno.resources();
closeRes(rBefore, rAfter);
}, },
ignore: Deno.build.os === "windows", ignore: Deno.build.os === "windows",
}); });

View file

@ -1,7 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { assertEquals, fail } from "../../../../test_util/std/assert/mod.ts"; import { assertEquals, fail } from "../../../../test_util/std/assert/mod.ts";
import { rmdir, rmdirSync } from "node:fs"; import { rmdir, rmdirSync } from "node:fs";
import { closeSync } from "node:fs";
import { existsSync } from "node:fs"; import { existsSync } from "node:fs";
import { join } from "../../../../test_util/std/path/mod.ts"; import { join } from "../../../../test_util/std/path/mod.ts";
import { assertCallbackErrorUncaught } from "../_test_utils.ts"; import { assertCallbackErrorUncaught } from "../_test_utils.ts";
@ -32,27 +31,14 @@ Deno.test({
}, },
}); });
function closeRes(before: Deno.ResourceMap, after: Deno.ResourceMap) {
for (const key in after) {
if (!before[key]) {
try {
closeSync(Number(key));
} catch (error) {
return error;
}
}
}
}
Deno.test({ Deno.test({
name: "ASYNC: removing non-empty folder", name: "ASYNC: removing non-empty folder",
async fn() { async fn() {
const rBefore = Deno.resources();
const dir = Deno.makeTempDirSync(); const dir = Deno.makeTempDirSync();
Deno.createSync(join(dir, "file1.txt")); using _file1 = Deno.createSync(join(dir, "file1.txt"));
Deno.createSync(join(dir, "file2.txt")); using _file2 = Deno.createSync(join(dir, "file2.txt"));
Deno.mkdirSync(join(dir, "some_dir")); Deno.mkdirSync(join(dir, "some_dir"));
Deno.createSync(join(dir, "some_dir", "file.txt")); using _file = Deno.createSync(join(dir, "some_dir", "file.txt"));
await new Promise<void>((resolve, reject) => { await new Promise<void>((resolve, reject) => {
rmdir(dir, { recursive: true }, (err) => { rmdir(dir, { recursive: true }, (err) => {
if (err) reject(err); if (err) reject(err);
@ -62,8 +48,6 @@ Deno.test({
.then(() => assertEquals(existsSync(dir), false), () => fail()) .then(() => assertEquals(existsSync(dir), false), () => fail())
.finally(() => { .finally(() => {
if (existsSync(dir)) Deno.removeSync(dir, { recursive: true }); if (existsSync(dir)) Deno.removeSync(dir, { recursive: true });
const rAfter = Deno.resources();
closeRes(rBefore, rAfter);
}); });
}, },
ignore: Deno.build.os === "windows", ignore: Deno.build.os === "windows",
@ -72,17 +56,13 @@ Deno.test({
Deno.test({ Deno.test({
name: "SYNC: removing non-empty folder", name: "SYNC: removing non-empty folder",
fn() { fn() {
const rBefore = Deno.resources();
const dir = Deno.makeTempDirSync(); const dir = Deno.makeTempDirSync();
Deno.createSync(join(dir, "file1.txt")); using _file1 = Deno.createSync(join(dir, "file1.txt"));
Deno.createSync(join(dir, "file2.txt")); using _file2 = Deno.createSync(join(dir, "file2.txt"));
Deno.mkdirSync(join(dir, "some_dir")); Deno.mkdirSync(join(dir, "some_dir"));
Deno.createSync(join(dir, "some_dir", "file.txt")); using _file = Deno.createSync(join(dir, "some_dir", "file.txt"));
rmdirSync(dir, { recursive: true }); rmdirSync(dir, { recursive: true });
assertEquals(existsSync(dir), false); assertEquals(existsSync(dir), false);
// closing resources
const rAfter = Deno.resources();
closeRes(rBefore, rAfter);
}, },
ignore: Deno.build.os === "windows", ignore: Deno.build.os === "windows",
}); });

View file

@ -3889,6 +3889,8 @@ declare namespace Deno {
* A map of open resources that Deno is tracking. The key is the resource ID * A map of open resources that Deno is tracking. The key is the resource ID
* (_rid_) and the value is its representation. * (_rid_) and the value is its representation.
* *
* @deprecated {@linkcode Deno.resources} will be removed in Deno 2.0.
*
* @category Observability */ * @category Observability */
interface ResourceMap { interface ResourceMap {
[rid: number]: unknown; [rid: number]: unknown;
@ -3907,6 +3909,8 @@ declare namespace Deno {
* // { 0: "stdin", 1: "stdout", 2: "stderr", 3: "fsFile" } * // { 0: "stdin", 1: "stdout", 2: "stderr", 3: "fsFile" }
* ``` * ```
* *
* @deprecated {@linkcode Deno.resources} will be removed in Deno 2.0.
*
* @category Observability * @category Observability
*/ */
export function resources(): ResourceMap; export function resources(): ResourceMap;

View file

@ -316,7 +316,7 @@ function closeSession(session: Http2Session, code?: number, error?: Error) {
session[kDenoConnRid], session[kDenoConnRid],
session[kDenoClientRid], session[kDenoClientRid],
); );
console.table(Deno.resources()); console.table(Deno[Deno.internal].core.resources());
if (session[kDenoConnRid]) { if (session[kDenoConnRid]) {
core.tryClose(session[kDenoConnRid]); core.tryClose(session[kDenoConnRid]);
} }

View file

@ -534,7 +534,10 @@ const internalSymbol = Symbol("Deno.internal");
const finalDenoNs = { const finalDenoNs = {
internal: internalSymbol, internal: internalSymbol,
[internalSymbol]: internals, [internalSymbol]: internals,
resources: core.resources, resources() {
internals.warnOnDeprecatedApi("Deno.resources()", new Error().stack);
return core.resources();
},
close: core.close, close: core.close,
...denoNs, ...denoNs,
// Deno.test and Deno.bench are noops here, but kept for compatibility; so // Deno.test and Deno.bench are noops here, but kept for compatibility; so

View file

@ -20,7 +20,7 @@ const [libPrefix, libSuffix] = {
}[Deno.build.os]; }[Deno.build.os];
const libPath = `${targetDir}/${libPrefix}test_ffi.${libSuffix}`; const libPath = `${targetDir}/${libPrefix}test_ffi.${libSuffix}`;
const resourcesPre = Deno.resources(); const resourcesPre = Deno[Deno.internal].core.resources();
// dlopen shouldn't panic // dlopen shouldn't panic
assertThrows(() => { assertThrows(() => {
@ -765,7 +765,7 @@ testOptimized(hash, () => hash());
nestedCallback.close(); nestedCallback.close();
addToFooCallback.close(); addToFooCallback.close();
const resourcesPost = Deno.resources(); const resourcesPost = Deno[Deno.internal].core.resources();
const preStr = JSON.stringify(resourcesPre, null, 2); const preStr = JSON.stringify(resourcesPre, null, 2);
const postStr = JSON.stringify(resourcesPost, null, 2); const postStr = JSON.stringify(resourcesPost, null, 2);

View file

@ -9,8 +9,6 @@ const [libPrefix, libSuffix] = {
}[Deno.build.os]; }[Deno.build.os];
const libPath = `${targetDir}/${libPrefix}test_ffi.${libSuffix}`; const libPath = `${targetDir}/${libPrefix}test_ffi.${libSuffix}`;
const resourcesPre = Deno.resources();
const dylib = Deno.dlopen(libPath, { const dylib = Deno.dlopen(libPath, {
store_function: { store_function: {
parameters: ["function"], parameters: ["function"],