From 349dd7dbfc8b76f29a30499380c9cfc8f89f6b59 Mon Sep 17 00:00:00 2001 From: lvqq Date: Wed, 23 Nov 2022 11:37:16 +0800 Subject: [PATCH] test: add builtin module test case --- packages/jest-resolve/src/__tests__/resolve.test.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/jest-resolve/src/__tests__/resolve.test.ts b/packages/jest-resolve/src/__tests__/resolve.test.ts index 0deb0fb025e6..7676dd5d5db0 100644 --- a/packages/jest-resolve/src/__tests__/resolve.test.ts +++ b/packages/jest-resolve/src/__tests__/resolve.test.ts @@ -723,7 +723,15 @@ 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'; @@ -731,7 +739,7 @@ describe('Resolver.getGlobalPaths()', () => { 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';