Skip to content

Commit

Permalink
Remove reliance on util.inspect in snapshot tests
Browse files Browse the repository at this point in the history
Summary:
According to Node's documentation: https://nodejs.org/api/util.html#util_util_inspect_object_showhidden_depth_colors

> The util.inspect() method returns a string representation of object that is intended for debugging. **The output of util.inspect may change at any time and should not be depended upon programmatically.**

Therefore, this diff switches over our RN Codegen snapshot tests to use a `JSON.stringify` call, followed by a replace of `"` with `'`. This gets the job done without compromising readability.

**Question:** Why do we not use `"`? A: Jest escapes all `"` in the snapshots, which makes reading the snapshots/using them in the console harder.

Changelog: [Internal]

Reviewed By: hramos

Differential Revision: D24157056

fbshipit-source-id: 2f1aa2df28ac3ed4aa17bcdbcd23846ddbf804cf
  • Loading branch information
RSNara authored and facebook-github-bot committed Oct 7, 2020
1 parent 1015194 commit 8e943d8
Show file tree
Hide file tree
Showing 4 changed files with 5,832 additions and 4,862 deletions.
Loading

0 comments on commit 8e943d8

Please sign in to comment.