mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
d24c7313f7
PR-URL: https://github.com/nodejs/node/pull/54563 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
17 lines
402 B
JavaScript
17 lines
402 B
JavaScript
import { fileURLToPath } from 'url';
|
|
import { createRequire } from 'module';
|
|
|
|
const rawRequire = createRequire(fileURLToPath(import.meta.url));
|
|
|
|
export function directRequireFixture(specifier) {
|
|
return rawRequire(specifier);
|
|
}
|
|
|
|
export async function requireFixture(specifier) {
|
|
return { default: rawRequire(specifier ) };
|
|
}
|
|
|
|
export function importFixture(specifier) {
|
|
return import(specifier);
|
|
}
|