Skip to content

Commit

Permalink
Make patterns private
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonchinn178 committed Mar 6, 2024
1 parent 57e3763 commit 9cd9734
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions packages/jest-types/src/TestPathPatterns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
import {escapePathForRegex, replacePathSepForRegex} from 'jest-regex-util';

export class TestPathPatterns {
constructor(readonly patterns: Array<string>) {}
constructor(private readonly patterns: Array<string>) {}

getPatterns(): Array<string> {
return this.patterns;
}

/**
* Return true if there are any patterns.
Expand Down Expand Up @@ -61,7 +65,7 @@ export class TestPathPatternsExecutor {
private _regexString: string | null = null;

constructor(
readonly patterns: TestPathPatterns,
private readonly testPathPatterns: TestPathPatterns,
private readonly options: TestPathPatternsExecutorOptions,
) {}

Expand All @@ -73,7 +77,7 @@ export class TestPathPatternsExecutor {
const rootDir = this.options.rootDir.replace(/\/*$/, '/');
const rootDirRegex = escapePathForRegex(rootDir);

const regexString = this.patterns.patterns
const regexString = this.getPatterns()
.map(p => {
// absolute paths passed on command line should stay same
if (p.startsWith('/')) {
Expand All @@ -99,11 +103,15 @@ export class TestPathPatternsExecutor {
return new RegExp(this.regexString, 'i');
}

getPatterns(): Array<string> {
return this.testPathPatterns.getPatterns();
}

/**
* Return true if there are any patterns.
*/
isSet(): boolean {
return this.patterns.isSet();
return this.testPathPatterns.isSet();
}

/**
Expand Down Expand Up @@ -131,6 +139,6 @@ export class TestPathPatternsExecutor {
* Return a human-friendly version of the pattern regex.
*/
toPretty(): string {
return this.patterns.toPretty();
return this.testPathPatterns.toPretty();
}
}

0 comments on commit 9cd9734

Please sign in to comment.