From f474c4f4ff2db301573a228fba0b65f9f4970f8c Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Fri, 9 Aug 2024 14:25:33 +0200 Subject: fix: stub `node:module.register()` (#24965) This is commonly used to register loading non standard file types. But some libs also register TS loaders which Deno supports natively, like the npm `payload` package. This PR unblocks those. Fixes https://github.com/denoland/deno/issues/24902 --- tests/unit_node/module_test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/unit_node/module_test.ts') diff --git a/tests/unit_node/module_test.ts b/tests/unit_node/module_test.ts index 25249101a..994dcfb63 100644 --- a/tests/unit_node/module_test.ts +++ b/tests/unit_node/module_test.ts @@ -6,6 +6,11 @@ import { findSourceMap, isBuiltin, Module, + // @ts-ignore Our internal @types/node is at v18.16.19 which predates + // this change. Updating it is difficult due to different types in Node + // for `import.meta.filename` and `import.meta.dirname` that Deno + // provides. + register, } from "node:module"; import { assert, assertEquals } from "@std/assert"; import process from "node:process"; @@ -99,3 +104,8 @@ Deno.test("[node/module builtinModules] has 'module' in builtins", () => { Deno.test("[node/module findSourceMap] is a function", () => { assertEquals(findSourceMap("foo"), undefined); }); + +// https://github.com/denoland/deno/issues/24902 +Deno.test("[node/module register] is a function", () => { + assertEquals(register("foo"), undefined); +}); -- cgit v1.2.3