Skip to content

Commit

Permalink
fix(jest-resolve): usage of node: imports for builtin modules
Browse files Browse the repository at this point in the history
  • Loading branch information
theoludwig authored and SimenB committed Aug 16, 2021
1 parent 78f308e commit 4668312
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/jest-resolve/src/__tests__/resolve.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,20 @@ describe('isCoreModule', () => {
const isCore = resolver.isCoreModule('constants');
expect(isCore).toEqual(false);
});

it('returns true if using `node:` URLs and `moduleName` is a core module.', () => {
const moduleMap = ModuleMap.create('/');
const resolver = new Resolver(moduleMap, {} as ResolverConfig);
const isCore = resolver.isCoreModule('node:assert');
expect(isCore).toEqual(true);
});

it('returns false if using `node:` URLs and `moduleName` is not a core module.', () => {
const moduleMap = ModuleMap.create('/');
const resolver = new Resolver(moduleMap, {} as ResolverConfig);
const isCore = resolver.isCoreModule('node:not-a-core-module');
expect(isCore).toEqual(false);
});
});

describe('findNodeModule', () => {
Expand Down

0 comments on commit 4668312

Please sign in to comment.