Skip to content

Commit

Permalink
test: add builtin module test case
Browse files Browse the repository at this point in the history
  • Loading branch information
lvqq committed Nov 23, 2022
1 parent 6dc8310 commit 349dd7d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/jest-resolve/src/__tests__/resolve.test.ts
Expand Up @@ -723,15 +723,23 @@ describe('Resolver.getGlobalPaths()', () => {
expect(globalPaths.length).toBeGreaterThanOrEqual(1);
});

it('return empty with relative path', () => {
it('return empty array with builtin module', () => {
jest.doMock('path', () => _path.posix);
const resolver = new Resolver(moduleMap, {} as ResolverConfig);
const cwd = '/temp/project';
const globalPaths = resolver.getGlobalPaths(cwd, 'fs');
expect(globalPaths).toStrictEqual([]);
});

it('return empty array with relative path', () => {
jest.doMock('path', () => _path.posix);
const resolver = new Resolver(moduleMap, {} as ResolverConfig);
const cwd = '/temp/project';
const globalPaths = resolver.getGlobalPaths(cwd, './module');
expect(globalPaths).toStrictEqual([]);
});

it('return empty without module name', () => {
it('return empty array without module name', () => {
jest.doMock('path', () => _path.posix);
const resolver = new Resolver(moduleMap, {} as ResolverConfig);
const cwd = '/temp/project';
Expand Down

0 comments on commit 349dd7d

Please sign in to comment.