1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-11 00:21:05 -05:00

fix(node): stub findSourceMap for ava (#23899)

This stubs `findSourceMap` in `node:module` by always returning
`undefined` as if it never found a source map. This unblocks the `ava`
test runner.

Fixes https://github.com/denoland/deno/issues/18666
This commit is contained in:
Marvin Hagemeister 2024-05-20 16:42:42 +02:00 committed by GitHub
parent fb3f82b9ea
commit eb97f110db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 1 deletions

View file

@ -1261,6 +1261,15 @@ internals.requireImpl = {
nativeModuleExports,
};
/**
* @param {string} path
* @returns {SourceMap | undefined}
*/
export function findSourceMap(_path) {
// TODO(@marvinhagemeister): Stub implementation for now to unblock ava
return undefined;
}
export { builtinModules, createRequire, isBuiltin, Module };
export const _cache = Module._cache;
export const _extensions = Module._extensions;

View file

@ -1,6 +1,12 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { builtinModules, createRequire, isBuiltin, Module } from "node:module";
import {
builtinModules,
createRequire,
findSourceMap,
isBuiltin,
Module,
} from "node:module";
import { assert, assertEquals } from "@std/assert/mod.ts";
import process from "node:process";
import * as path from "node:path";
@ -88,3 +94,8 @@ Deno.test("[node/module isBuiltin] recognizes node builtins", () => {
Deno.test("[node/module builtinModules] has 'module' in builtins", () => {
assert(builtinModules.includes("module"));
});
// https://github.com/denoland/deno/issues/18666
Deno.test("[node/module findSourceMap] is a function", () => {
assertEquals(findSourceMap("foo"), undefined);
});