Skip to content

Commit b1d5c47

Browse files
committed
chore: bump unrs-resolver to 1.11.0, remove unnecessary checks
1 parent fd3d6cf commit b1d5c47

File tree

7 files changed

+112
-121
lines changed

7 files changed

+112
-121
lines changed

.yarnrc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ compressionLevel: mixed
22

33
enableGlobalCache: true
44

5+
enableTelemetry: false
6+
57
logFilters:
68
- code: YN0032
79
level: discard

e2e/__tests__/__snapshots__/moduleNameMapper.test.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ exports[`moduleNameMapper wrong array configuration 1`] = `
4141
12 | module.exports = () => 'test';
4242
13 |
4343
44-
at createNoMappedModuleFoundError (../../packages/jest-resolve/build/index.js:1117:17)
44+
at createNoMappedModuleFoundError (../../packages/jest-resolve/build/index.js:1095:17)
4545
at Object.require (index.js:10:1)
4646
at Object.require (__tests__/index.js:10:20)"
4747
`;
@@ -71,7 +71,7 @@ exports[`moduleNameMapper wrong configuration 1`] = `
7171
12 | module.exports = () => 'test';
7272
13 |
7373
74-
at createNoMappedModuleFoundError (../../packages/jest-resolve/build/index.js:1117:17)
74+
at createNoMappedModuleFoundError (../../packages/jest-resolve/build/index.js:1095:17)
7575
at Object.require (index.js:10:1)
7676
at Object.require (__tests__/index.js:10:20)"
7777
`;

e2e/__tests__/__snapshots__/requireMissingExt.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ exports[`shows a proper error from deep requires 1`] = `
2626
12 | test('dummy', () => {
2727
13 | expect(1).toBe(1);
2828
29-
at Resolver._throwModNotFoundError (../../packages/jest-resolve/build/index.js:863:11)
29+
at Resolver._throwModNotFoundError (../../packages/jest-resolve/build/index.js:841:11)
3030
at Object.<anonymous> (node_modules/discord.js/src/index.js:21:12)
3131
at Object.require (__tests__/test.js:10:1)"
3232
`;

e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ exports[`show error message with matching files 1`] = `
3737
| ^
3838
9 |
3939
40-
at Resolver._throwModNotFoundError (../../packages/jest-resolve/build/index.js:863:11)
40+
at Resolver._throwModNotFoundError (../../packages/jest-resolve/build/index.js:841:11)
4141
at Object.require (index.js:8:18)
4242
at Object.require (__tests__/test.js:8:11)"
4343
`;

packages/jest-resolve/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@
2222
"chalk": "^4.1.2",
2323
"graceful-fs": "^4.2.11",
2424
"jest-haste-map": "workspace:*",
25-
"jest-pnp-resolver": "^1.2.3",
2625
"jest-util": "workspace:*",
2726
"jest-validate": "workspace:*",
2827
"slash": "^3.0.0",
29-
"unrs-resolver": "^1.7.11"
28+
"unrs-resolver": "^1.11.0"
3029
},
3130
"devDependencies": {
3231
"@types/graceful-fs": "^4.1.9",

packages/jest-resolve/src/defaultResolver.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
*/
77

88
import {isBuiltin} from 'module';
9-
import {fileURLToPath} from 'url';
10-
import pnpResolver from 'jest-pnp-resolver';
119
import {
1210
type ResolveResult,
1311
ResolverFactory,
@@ -40,12 +38,6 @@ export interface ResolverOptions extends UpstreamResolveOptions {
4038
paths?: Array<string>;
4139
/** Current root directory. */
4240
rootDir?: string;
43-
44-
/**
45-
* @internal Whether to allow the `jest-pnp-resolver` to be used.
46-
* @see https://github.com/arcanis/jest-pnp-resolver/blob/ae8e3992349f3b43d1476572e9315e14358e8944/index.js#L49
47-
*/
48-
allowPnp?: boolean;
4941
}
5042

5143
export type SyncResolver = (path: string, options: ResolverOptions) => string;
@@ -74,20 +66,11 @@ function baseResolver(
7466
options: ResolverOptions,
7567
async?: true,
7668
): string | Promise<string> {
77-
// https://github.com/oxc-project/oxc-resolver/issues/565
78-
// https://github.com/jestjs/jest/issues/15676
69+
// `builtins` in `unrs-resolver` is static which could be wrong at runtime.
7970
if (isBuiltin(path)) {
8071
return path;
8172
}
8273

83-
if (process.versions.pnp && options.allowPnp !== false) {
84-
return pnpResolver(path, options);
85-
}
86-
87-
if (path.startsWith('file://')) {
88-
path = fileURLToPath(path);
89-
}
90-
9174
/* eslint-disable prefer-const */
9275
let {
9376
basedir,

0 commit comments

Comments
 (0)