File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 * LICENSE file in the root directory of this source tree.
66 */
77
8- import { types } from 'node:util' ;
98import * as path from 'path' ;
109import co from 'co' ;
1110import dedent from 'dedent' ;
@@ -19,6 +18,7 @@ import {
1918 convertDescriptorToString ,
2019 formatTime ,
2120 invariant ,
21+ isError ,
2222 isPromise ,
2323} from 'jest-util' ;
2424import { 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
454454const formatErrorStackWithCause = ( error : Error , seen : Set < Error > ) : string => {
Original file line number Diff line number Diff line change 55 * LICENSE file in the root directory of this source tree.
66 */
77
8- import { types } from 'util' ;
98import {
109 type AssertionResult ,
1110 type FailedAssertion ,
@@ -14,6 +13,7 @@ import {
1413} from '@jest/test-result' ;
1514import type { Config } from '@jest/types' ;
1615import { formatResultsErrors } from 'jest-message-util' ;
16+ import { isError } from 'jest-util' ;
1717import type { SpecResult } from './jasmine/Spec' ;
1818import type { SuiteResult } from './jasmine/Suite' ;
1919import type { Reporter , RunDetails } from './types' ;
@@ -23,10 +23,10 @@ type Microseconds = number;
2323const 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
3232const formatErrorStackWithCause = ( error : Error , seen : Set < Error > ) : string => {
You can’t perform that action at this time.
0 commit comments