From aa5b3a0974d2feb0efc4e7f22923318f0c8e974c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=A4nisch?= Date: Tue, 5 Jan 2021 23:59:02 +0100 Subject: [PATCH 1/2] fix(pretty-format): only call `hasAttribute` if function --- packages/pretty-format/src/plugins/DOMElement.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pretty-format/src/plugins/DOMElement.ts b/packages/pretty-format/src/plugins/DOMElement.ts index 48e46ae39d7c..e500620dd5d0 100644 --- a/packages/pretty-format/src/plugins/DOMElement.ts +++ b/packages/pretty-format/src/plugins/DOMElement.ts @@ -27,7 +27,7 @@ const testNode = (val: any) => { const {nodeType, tagName} = val; const isCustomElement = (typeof tagName === 'string' && tagName.includes('-')) || - val.hasAttribute?.('is'); + (typeof val.hasAttribute === 'function' && val.hasAttribute('is')); return ( (nodeType === ELEMENT_NODE && From 700d93708d9b8d1af27f5bc35c2ab07ffbef9ce6 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Wed, 6 Jan 2021 12:59:16 +0100 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d655334ef71..97a5b59da377 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,9 +49,10 @@ - `[jest-transform]` Show enhanced `SyntaxError` message for all `SyntaxError`s ([#10749](https://github.com/facebook/jest/pull/10749)) - `[jest-transform]` [**BREAKING**] Refactor API to pass an options bag around rather than multiple boolean options ([#10753](https://github.com/facebook/jest/pull/10753)) - `[jest-transform]` [**BREAKING**] Refactor API of transformers to pass an options bag rather than separate `config` and other options ([#10834](https://github.com/facebook/jest/pull/10834)) -- `[jest-worker]` [**BREAKING**] Use named exports ([#10623] (https://github.com/facebook/jest/pull/10623)) -- `[jest-worker]` Do not swallow errors during serialization ([#10984] (https://github.com/facebook/jest/pull/10984)) +- `[jest-worker]` [**BREAKING**] Use named exports ([#10623](https://github.com/facebook/jest/pull/10623)) +- `[jest-worker]` Do not swallow errors during serialization ([#10984](https://github.com/facebook/jest/pull/10984)) - `[pretty-format]` [**BREAKING**] Convert to ES Modules ([#10515](https://github.com/facebook/jest/pull/10515)) +- `[pretty-format]` Only call `hasAttribute` if it's a function ([#11000](https://github.com/facebook/jest/pull/11000)) ### Chore & Maintenance