mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
61f3a5c60a
Refs: https://github.com/nodejs/modules/issues/358 PR-URL: https://github.com/nodejs/node/pull/28831 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
13 lines
317 B
JavaScript
13 lines
317 B
JavaScript
import { fileURLToPath } from 'url';
|
|
import { createRequire } from 'module';
|
|
|
|
const rawRequire = createRequire(fileURLToPath(import.meta.url));
|
|
|
|
export async function requireFixture(specifier) {
|
|
return { default: rawRequire(specifier ) };
|
|
}
|
|
|
|
export function importFixture(specifier) {
|
|
return import(specifier);
|
|
}
|