From f4b11db072c82f1c5e3af6e601faf3626728ab50 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Fri, 5 Apr 2024 17:08:00 +0530 Subject: [PATCH] fix(ext/node): Add "module" to builtinsModule (#23242) Fixes https://github.com/denoland/deno/issues/22731 --- ext/node/polyfills/01_require.js | 1 + tests/unit_node/module_test.ts | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ext/node/polyfills/01_require.js b/ext/node/polyfills/01_require.js index 8d34a51b1b..27c10bf584 100644 --- a/ext/node/polyfills/01_require.js +++ b/ext/node/polyfills/01_require.js @@ -218,6 +218,7 @@ function setupBuiltinModules() { "internal/util/inspect": internalUtilInspect, "internal/util": internalUtil, net, + module: Module, os, "path/posix": pathPosix, "path/win32": pathWin32, diff --git a/tests/unit_node/module_test.ts b/tests/unit_node/module_test.ts index eb18258902..cfb9a4ebfe 100644 --- a/tests/unit_node/module_test.ts +++ b/tests/unit_node/module_test.ts @@ -1,6 +1,6 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -import { createRequire, isBuiltin, Module } from "node:module"; +import { builtinModules, createRequire, isBuiltin, Module } from "node:module"; import { assert, assertEquals } from "@std/assert/mod.ts"; import process from "node:process"; import * as path from "node:path"; @@ -83,3 +83,8 @@ Deno.test("[node/module isBuiltin] recognizes node builtins", () => { // deno-lint-ignore no-explicit-any assert(!isBuiltin(undefined as any)); }); + +// https://github.com/denoland/deno/issues/22731 +Deno.test("[node/module builtinModules] has 'module' in builtins", () => { + assert(builtinModules.includes("module")); +});