| 1 | import hasOwnProperty from 'shared/hasOwnProperty'; |
| 2 | |
| 3 | const FILTERED_VERSION_STRING = '<filtered-version>'; |
| 4 | |
| 5 | // `test` is part of Jest's serializer API |
| 6 | export function test(maybeProfile) { |
| 7 | if ( |
| 8 | maybeProfile != null && |
| 9 | typeof maybeProfile === 'object' && |
| 10 | hasOwnProperty.call(maybeProfile, 'reactVersion') && |
| 11 | maybeProfile.reactVersion !== FILTERED_VERSION_STRING |
| 12 | ) { |
| 13 | return true; |
| 14 | } |
| 15 | |
| 16 | return false; |
| 17 | } |
| 18 | |
| 19 | // print() is part of Jest's serializer API |
| 20 | export function print(profile, serialize, indent) { |
| 21 | return serialize({ |
| 22 | ...profile, |
| 23 | reactVersion: FILTERED_VERSION_STRING, |
| 24 | }); |
| 25 | } |