Skip to content

Commit

Permalink
chore: fix module test for Node v16
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Apr 20, 2021
1 parent 88cfe4a commit a5ac3c5
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/jest-runtime/src/__tests__/runtime_require_module.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,16 @@ describe('Runtime requireModule', () => {
expect(customRequire('./create_require_module').foo).toBe('foo');
}

expect(exports.syncBuiltinESMExports).not.toThrow();
expect(exports.builtinModules).toEqual(builtinModules);
});
});

onNodeVersions('>=12.12.0 <16.0.0', () => {
it('overrides module.createRequireFromPath', async () => {
const runtime = await createRuntime(__filename);
const exports = runtime.requireModule(runtime.__mockRootPath, 'module');

// createRequire with relative module path
expect(() => exports.createRequireFromPath('./relative/path')).toThrow(
new TypeError(
Expand All @@ -409,9 +419,6 @@ describe('Runtime requireModule', () => {
)}'. Use createRequire for URL filename.`,
),
);

expect(exports.syncBuiltinESMExports).not.toThrow();
expect(exports.builtinModules).toEqual(builtinModules);
});
});
});

0 comments on commit a5ac3c5

Please sign in to comment.