Skip to content

Commit

Permalink
Cleanup displayName type
Browse files Browse the repository at this point in the history
  • Loading branch information
kenrick95 committed May 15, 2020
1 parent 56079a5 commit 783c908
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
3 changes: 0 additions & 3 deletions packages/jest-core/src/getProjectDisplayName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ export default function getProjectDisplayName(
if (!displayName) {
return undefined;
}
if (typeof displayName === 'string') {
return displayName;
}
if (typeof displayName === 'object') {
return displayName.name;
}
Expand Down
4 changes: 0 additions & 4 deletions packages/jest-reporters/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ export const printDisplayName = (config: Config.ProjectConfig): string => {
return '';
}

if (typeof displayName === 'string') {
return chalk.supportsColor ? white(` ${displayName} `) : displayName;
}

const {name, color} = displayName;
const chosenColor = chalk.reset.inverse[color]
? chalk.reset.inverse[color]
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-test-result/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const buildFailureTestResult = (
err: SerializableError,
): TestResult => ({
console: undefined,
displayName: '',
displayName: undefined,
failureMessage: null,
leaks: false,
numFailingTests: 0,
Expand Down
12 changes: 5 additions & 7 deletions packages/jest-types/src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,10 @@ export type DefaultOptions = {
watchman: boolean;
};

export type DisplayName =
| string
| {
name: string;
color: typeof chalk.Color;
};
export type DisplayName = {
name: string;
color: typeof chalk.Color;
};

export type InitialOptionsWithRootDir = InitialOptions &
Required<Pick<InitialOptions, 'rootDir'>>;
Expand Down Expand Up @@ -119,7 +117,7 @@ export type InitialOptions = Partial<{
dependencyExtractor: string;
detectLeaks: boolean;
detectOpenHandles: boolean;
displayName: DisplayName;
displayName: string | DisplayName;
expand: boolean;
extraGlobals: Array<string>;
filter: Path;
Expand Down

0 comments on commit 783c908

Please sign in to comment.