Skip to content

Commit

Permalink
chore: implemented typing and checker for customMockPatterns
Browse files Browse the repository at this point in the history
  • Loading branch information
scarletquasar committed Jul 18, 2023
1 parent 2499cf2 commit 6e2fd76
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/jest-resolve-dependencies/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,9 @@ export class DependencyResolver {
}

if (resolvedMockDependency != null) {
const dependencyMockDir = path.resolve(
path.dirname(resolvedDependency),
'__mocks__',
);
const dependencyMockDir = options?.customMockPath != null
? path.resolve(path.dirname(resolvedDependency), '__mocks__')
: options?.customMockPath;

resolvedMockDependency = path.resolve(resolvedMockDependency);

Expand Down
1 change: 1 addition & 0 deletions packages/jest-resolve/src/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export type ResolveModuleConfig = {
conditions?: Array<string>;
skipNodeResolution?: boolean;
paths?: Array<string>;
customMockPath?: string;
};

const NATIVE_PLATFORM = 'native';
Expand Down
1 change: 1 addition & 0 deletions packages/jest-types/src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ export type ProjectConfig = {
collectCoverageFrom: Array<string>;
coverageDirectory: string;
coveragePathIgnorePatterns: Array<string>;
customMockPath?: string;
cwd: string;
dependencyExtractor?: string;
detectLeaks: boolean;
Expand Down

0 comments on commit 6e2fd76

Please sign in to comment.