Skip to content

Commit 84f7ab8

Browse files
committed
Fix false-positive snapshot mismatch
Same reason why jest can fail with "could not find all inline snapshots". Since we don't need "done()" on async tests we can safely remove it.
1 parent c1f9a91 commit 84f7ab8

File tree

6 files changed

+201
-233
lines changed

6 files changed

+201
-233
lines changed

packages/react-devtools-shared/src/__tests__/dehydratedValueSerializer.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,20 @@
99

1010
// test() is part of Jest's serializer API
1111
export function test(maybeDehydratedValue) {
12+
if (
13+
maybeDehydratedValue === null ||
14+
typeof maybeDehydratedValue !== 'object'
15+
) {
16+
return false;
17+
}
18+
19+
const hasOwnProperty = Object.prototype.hasOwnProperty.bind(
20+
maybeDehydratedValue,
21+
);
22+
1223
const {meta} = require('react-devtools-shared/src/hydration');
1324
return (
14-
maybeDehydratedValue !== null &&
15-
typeof maybeDehydratedValue === 'object' &&
16-
maybeDehydratedValue.hasOwnProperty(meta.inspectable) &&
25+
hasOwnProperty(meta.inspectable) &&
1726
maybeDehydratedValue[meta.inspected] !== true
1827
);
1928
}

0 commit comments

Comments
 (0)