Skip to content

Commit

Permalink
refactor: use nullish coalescing operator on getProjectDisplayName (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ftonato authored May 16, 2021
1 parent 04b7597 commit ecb0a9b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
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;
}
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;
this._timers.delete(timerHandle);
callback();
timer.callback();
break;

case 'interval':
Expand Down

0 comments on commit ecb0a9b

Please sign in to comment.