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:
parent
fb3f82b9ea
commit
eb97f110db
2 changed files with 21 additions and 1 deletions
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue