Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1907d76

Browse files
committed
one more
1 parent a946298 commit 1907d76

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

packages/jest-circus/src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
import {types} from 'node:util';
98
import * as path from 'path';
109
import co from 'co';
1110
import dedent from 'dedent';
@@ -19,6 +18,7 @@ import {
1918
convertDescriptorToString,
2019
formatTime,
2120
invariant,
21+
isError,
2222
isPromise,
2323
} from 'jest-util';
2424
import {format as prettyFormat} from 'pretty-format';
@@ -448,7 +448,7 @@ const isErrorOrStackWithCause = (
448448
typeof errorOrStack !== 'string' &&
449449
'cause' in errorOrStack &&
450450
(typeof errorOrStack.cause === 'string' ||
451-
types.isNativeError(errorOrStack.cause) ||
451+
isError(errorOrStack.cause) ||
452452
errorOrStack.cause instanceof Error);
453453

454454
const formatErrorStackWithCause = (error: Error, seen: Set<Error>): string => {

packages/jest-jasmine2/src/reporter.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
import {types} from 'util';
98
import {
109
type AssertionResult,
1110
type FailedAssertion,
@@ -14,6 +13,7 @@ import {
1413
} from '@jest/test-result';
1514
import type {Config} from '@jest/types';
1615
import {formatResultsErrors} from 'jest-message-util';
16+
import {isError} from 'jest-util';
1717
import type {SpecResult} from './jasmine/Spec';
1818
import type {SuiteResult} from './jasmine/Suite';
1919
import type {Reporter, RunDetails} from './types';
@@ -23,10 +23,10 @@ type Microseconds = number;
2323
const isErrorWithCause = (
2424
error: unknown,
2525
): error is Error & {cause: Error | string} =>
26-
(types.isNativeError(error) || error instanceof Error) &&
26+
(isError(error) || error instanceof Error) &&
2727
'cause' in error &&
2828
(typeof error.cause === 'string' ||
29-
types.isNativeError(error.cause) ||
29+
isError(error.cause) ||
3030
error.cause instanceof Error);
3131

3232
const formatErrorStackWithCause = (error: Error, seen: Set<Error>): string => {

0 commit comments

Comments
 (0)