Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jest-resolve] Add support for packageFilter for custom resolvers #10393

Merged
merged 9 commits into from
Aug 12, 2020
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

### Features

- `[jest-resolve]` Add support for `packageFilter` on custom resolver ([#10393](https://github.com/facebook/jest/pull/10393))

### Fixes

### Chore & Maintenance
Expand Down
1 change: 1 addition & 0 deletions docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ This option allows the use of a custom resolver. This resolver must be a node mo
"extensions": [string],
"moduleDirectory": [string],
"paths": [string],
"packageFilter": "function(pkg, pkgdir)",
"rootDir": [string]
}
```
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-resolve/src/defaultResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type ResolverOptions = {
moduleDirectory?: Array<string>;
paths?: Array<Config.Path>;
rootDir?: Config.Path;
packageFilter?: (pkg: any, pkgfile: string) => any;
scinos marked this conversation as resolved.
Show resolved Hide resolved
};

declare global {
Expand All @@ -45,6 +46,7 @@ export default function defaultResolver(
isDirectory,
isFile,
moduleDirectory: options.moduleDirectory,
packageFilter: options.packageFilter,
paths: options.paths,
preserveSymlinks: false,
realpathSync,
Expand Down