question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Jest snapshot testing

See original GitHub issue

I see an error while trying to write a snapshot test.

TypeError: Cannot read property 'selectionEnd' of null at Object.updateValueState (node_modules/season-web-components/node_modules/cleave.js/dist/cleave-react.js:423:36) at Object.onInput (node_modules/season-web-components/node_modules/cleave.js/dist/cleave-react.js:366:16) at Object.init (node_modules/season-web-components/node_modules/cleave.js/dist/cleave-react.js:164:16) at Object.componentDidMount (node_modules/season-web-components/node_modules/cleave.js/dist/cleave-react.js:75:15) at Object.chainedFunction [as componentDidMount] (node_modules/season-web-components/node_modules/cleave.js/dist/cleave-react.js:1147:12) at node_modules/react-test-renderer/lib/ReactCompositeComponent.js:262:25 at measureLifeCyclePerf (node_modules/react-test-renderer/lib/ReactCompositeComponent.js:73:12) at node_modules/react-test-renderer/lib/ReactCompositeComponent.js:261:11 at CallbackQueue.notifyAll (node_modules/react-test-renderer/lib/CallbackQueue.js:74:22) at ReactTestReconcileTransaction.close (node_modules/react-test-renderer/lib/ReactTestReconcileTransaction.js:34:26) at ReactTestReconcileTransaction.closeAll (node_modules/react-test-renderer/lib/Transaction.js:207:25) at ReactTestReconcileTransaction.perform (node_modules/react-test-renderer/lib/Transaction.js:154:16) at batchedMountComponentIntoNode (node_modules/react-test-renderer/lib/ReactTestMount.js:67:27) at ReactDefaultBatchingStrategyTransaction.perform (node_modules/react-test-renderer/lib/Transaction.js:141:20) at Object.batchedUpdates (node_modules/react-test-renderer/lib/ReactDefaultBatchingStrategy.js:60:26) at Object.batchedUpdates (node_modules/react-test-renderer/lib/ReactUpdates.js:95:27) at Object.render [as create] (node_modules/react-test-renderer/lib/ReactTestMount.js:126:18)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
joelmosscommented, Mar 8, 2019

I can second this. I’m getting this same error with react.

0reactions
nosircommented, Jun 29, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

Snapshot Testing - Jest
Snapshot tests are a very useful tool whenever you want to make sure your UI does not change unexpectedly.
Read more >
Creating snapshots in Jest for testing React applications
Jest is a JavaScript testing framework that makes writing frontend tests like snapshots, unit tests, and component tests easy and efficient.
Read more >
How To Write Snapshot Tests For React Components With Jest
When writing snapshot tests for a React component, you first need to have code in a working state. Then, generate a snapshot of...
Read more >
Snapshot Testing · Jest - GitHub Pages
Snapshot tests are a very useful tool whenever you want to make sure your UI does not change unexpectedly. A typical snapshot test...
Read more >
Snapshot Testing: Benefits and Drawbacks - SitePen
Jest, as mentioned before, has built-in support for snapshot testing, and is frequently used to test React components. Cypress supports snapshot ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found