Skip to content

[Bug]: Snapshot tests failing for React 19 #15402

Open
contentful/rich-text
#756
@remarkablemark

Description

@remarkablemark

Version

29.7.0

Steps to reproduce

Clone repo:

git clone https://github.com/remarkablemark/html-react-parser.git
cd html-react-parser
git checkout build/package

Install deps:

npm i

Run tests:

npm test

See remarkablemark/html-react-parser#1629 (comment)

Expected behavior

Snapshot tests without issues

Actual behavior

Snapshot tests failing for React 19:

Error: expect(received).toMatchSnapshot()

Snapshot name: `domToReact converts single DOM node to React 1`

- Snapshot  -  3
+ Received  + 10

- <p>
-   foo
- </p>
+ {
+   "$$typeof": Symbol(react.transitional.element),
+   "_owner": null,
+   "_store": {},
+   "key": null,
+   "props": {
+     "children": "foo",
+   },
+   "type": "p",
+ }

    at Object.<anonymous> (__tests__/dom-to-react.test.tsx:24:26)

Image

Additional context

See blog post

Environment

System:
    OS: macOS 14.4.1
    CPU: (8) arm64 Apple M1 Pro
  Binaries:
    Node: 22.9.0 - ~/.nvm/versions/node/v22.9.0/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.8.3 - ~/.nvm/versions/node/v22.9.0/bin/npm
    pnpm: 9.14.4 - ~/Library/pnpm/pnpm
  npmPackages:
    jest: 29.7.0 => 29.7.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions