/
githubmirror
/
jest
Обзор
Документация
Войти
/
githubmirror
/
jest
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/jest-worker/src/workers/isDataCloneError.ts
27 строк
835 B
Dmitry Makhnev
fix(jest-worker): hangs caused by failed assertions with circular values (#15191)
23 июл 2024, 10:38
Не верифицирован
23 июл 2024, 10:38
5bfcc22
Код
Авторство
О чём код?
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // https://webidl.spec.whatwg.org/#datacloneerror const DATA_CLONE_ERROR_CODE = 25; /** * Unfortunately, [`util.types.isNativeError(value)`](https://nodejs.org/api/util.html#utiltypesisnativeerrorvalue) * return `false` for `DataCloneError` error. * For this reason, try to detect it in this way */ export function isDataCloneError(error: unknown): error is DOMException { return ( error != null && typeof error === 'object' && 'name' in error && error.name === 'DataCloneError' && 'message' in error && typeof error.message === 'string' && 'code' in error && error.code === DATA_CLONE_ERROR_CODE ); }