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

refactor: use nullish coalescing operator on getProjectDisplayName #11410

Merged
merged 4 commits into from
May 16, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/expect/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,7 @@ export const partition = <T>(
export const isError = (value: unknown): value is Error => {
switch (Object.prototype.toString.call(value)) {
case '[object Error]':
return true;
case '[object Exception]':
return true;
case '[object DOMException]':
return true;
default:
Expand Down
6 changes: 1 addition & 5 deletions packages/jest-core/src/getProjectDisplayName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,5 @@ import type {Config} from '@jest/types';
export default function getProjectDisplayName(
projectConfig: Config.ProjectConfig,
): string | undefined {
const {displayName} = projectConfig;
if (!displayName) {
return undefined;
}
return displayName.name;
return projectConfig?.displayName?.name ?? undefined;
ftonato marked this conversation as resolved.
Show resolved Hide resolved
}
3 changes: 1 addition & 2 deletions packages/jest-fake-timers/src/legacyFakeTimers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -526,9 +526,8 @@ export default class FakeTimers<TimerRef> {

switch (timer.type) {
case 'timeout':
const callback = timer.callback;
ftonato marked this conversation as resolved.
Show resolved Hide resolved
this._timers.delete(timerHandle);
callback();
timer.callback();
break;

case 'interval':
Expand Down