node/test/fixtures/pkgexports.mjs
Jan Krems 61f3a5c60a module: unify package exports test for CJS and ESM
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>
2019-07-31 13:33:46 -07:00

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);
}