Commit 212cf66
chore: Migrated enzyme tests to react-testing-render or @testing-library/react.
This is required for an upgrade to React 18, which enzyme does not support.
I've tried to keep the impact on the tests as small as possible.
Shallow snapshot tests use react-test-renderer/shallow.createRenderer
Deep snapshot tests use react-test-renderer.create
Interaction tests use @testing-library/react.render
In snapshots 'class' changed to 'className'.
The 'key' property is no longer emitted.
Injected HTML is formatted differently (quoted an no newlines).
Some tests navigated into the render output to pick out a smaller piece
to snapshot. That was too difficult to replicate.
There is a problem with the deabsdeep/serializer. It breaks
serialization of React Elements, because the map 'loses' the $$typeof
marker used by jest's native React serializer.
I've copied the serializer code into this project and fixed the problem.
In the future we could look at using this serializer selectively for
only tests that needs it.
deabsdeep library is still used in places, just not the serializer.1 parent 5e6f5cf commit 212cf66
File tree
70 files changed
+1011
-730
lines changed- docs
- src
- client/rsg-components
- Arguments
- __snapshots__
- Argument
- Code
- ComponentsList
- Components
- __snapshots__
- Editor
- __snapshots__
- Error
- Heading
- __snapshots__
- JsDoc
- Link
- Logo
- __snapshots__
- Markdown
- Blockquote
- __snapshots__
- Checkbox
- __snapshots__
- Details
- __snapshots__
- Hr
- __snapshots__
- List
- __snapshots__
- MarkdownHeading
- __snapshots__
- Pre
- __snapshots__
- Table
- __snapshots__
- __snapshots__
- Message
- Methods
- __snapshots__
- Name
- NotFound
- Para
- Pathline
- PlaygroundError
- Preview
- ReactExample
- __snapshots__
- SectionHeading
- __snapshots__
- Sections
- __snapshots__
- TableOfContents
- Table
- __snapshots__
- Text
- ToolbarButton
- __snapshots__
- Type
- Usage
- Version
- __snapshots__
- Welcome
- Wrapper
- slots
- loaders
- __tests__
- utils/__tests__/__snapshots__
- test
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
70 files changed
+1011
-730
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
| 117 | + | |
117 | 118 | | |
118 | 119 | | |
119 | 120 | | |
120 | 121 | | |
121 | | - | |
| 122 | + | |
122 | 123 | | |
123 | 124 | | |
0 commit comments