You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using snapshot testing with the react-test-renderer, rendering some innerHTML containing \r leads to unstable snapshots
If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can yarn install and yarn test.
Running the following test will always fail once you have created a snapshot
importReactfrom"react";importrendererfrom"react-test-renderer";constrenderToString=element=>renderer.create(element);it("should handle \\r in a stable manner",()=>{constel=(<divdangerouslySetInnerHTML={{__html: "a\r\nb\r\nc"}}/>);expect(renderToString(el)).toMatchSnapshot();});
FAIL lib/__tests__/cr.test.js
● should handle \r in a stable manner
Error
Error: expect(value).toMatchSnapshot()
Received value does not match stored snapshot 1.
- Snapshot
+ Received
<div
dangerouslySetInnerHTML={
Object {
- "__html": "a
- b
+ "__html": "a
+ b
c",
}
}
/>
at Object.<anonymous> (lib/__tests__/cr.test.js:9:29)
What is the expected behavior?
Test should succeed :-)
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
Jest 19, on Archlinux
The text was updated successfully, but these errors were encountered:
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
Do you want to request a feature or report a bug?
bug
What is the current behavior?
When using snapshot testing with the react-test-renderer, rendering some
innerHTML
containing\r
leads to unstable snapshotsIf the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can
yarn install
andyarn test
.Running the following test will always fail once you have created a snapshot
What is the expected behavior?
Test should succeed :-)
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
Jest 19, on Archlinux
The text was updated successfully, but these errors were encountered: