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.

Using TestUtils in v2.4

See original GitHub issue

How do I use TestUtils with react-rails v2.4? As far as I see TestUtils are no longer bundled in ReactAddons (removed from react-rails), but are available in ReactDOM. React manual states that to use TestUstils one must import/require react-dom/test-utils But how should I do it using react-rails?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
BookOfGregcommented, Jan 5, 2018

@wrzasa My apologies, I mistook this for another open issue without re-reading the comments. I do plan on working on the testing documentation within react-rails. This is currently 4th on my queue.

2reactions
wrzasacommented, Nov 22, 2017

I downgraded to 2.3.1, then fought with

Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner). in http://localhost:3000/assets/react-server.self-857bafe80cca2229eb9750a4b8396dd4ca9bea6760effc6dfd15c1a66996ca8c.js?body=1 (line 979)

for some time (but only in specs! widget in application worked correctly!), since app/assets/javascripts/server_rendering.js conveniently loaded react second time… finally after a few hours spent to make passing specs pass again on correctly working widget it all works.

So for rails4 and sprockets:

  • if you have problems with duplicates of React in specs (but not in development), check your app/assets/javascripts/server_rendering.js
  • I still don’t know how to use v2.4 and Reatc’s TestUtils (maybe it’s not possible – so its worth to mention it i README?).
Read more comments on GitHub >

github_iconTop Results From Across the Web

Test Utilities - React
ReactTestUtils makes it easy to test React components in the testing framework of your choice. At Facebook we use Jest for painless JavaScript...
Read more >
Vue Test Utils: Introduction
Vue Test Utils is the official unit testing utility library for Vue.js. This is the documentation for Vue Test Utils v1, which targets...
Read more >
Guide to ReflectionTestUtils for Unit Testing - Baeldung
In this tutorial, we'll learn how to use ReflectionTestUtils in unit testing by going through several examples. 2. Maven Dependencies.
Read more >
Vue Testing with Vue Test Utils - YouTube
In this video we will cover Vue testing with Vue Test Utils which uses Jest under the hood.Timeline:0:00 - Setup10:37 - Test Structure17:15 ......
Read more >
Using Vue test-utils and jest to test the value of a specific input ...
Using Vue test-utils and jest to test the value of a specific input element · Ask Question. Asked 2 years, 4 months ago....
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