From 128cca23b4c5353119316304981c349ed5dbf7e7 Mon Sep 17 00:00:00 2001 From: Yaroslav Serhieiev Date: Sat, 17 Feb 2024 12:32:04 +0200 Subject: [PATCH] fix: unhandled error for timeouts --- src/utils/isJestAssertionError.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/isJestAssertionError.ts b/src/utils/isJestAssertionError.ts index ac7957e..8affd55 100644 --- a/src/utils/isJestAssertionError.ts +++ b/src/utils/isJestAssertionError.ts @@ -1,7 +1,9 @@ import type { JestAssertionError } from 'expect'; +import { isError } from './isError'; + export function isJestAssertionError( error: unknown, ): error is JestAssertionError { - return error ? 'matcherResult' in (error as JestAssertionError) : false; + return isError(error) && 'matcherResult' in (error as JestAssertionError); }