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.

Refactor the React test suite to use React Testing Library

See original GitHub issue

This issue is to track the refactoring of our React test suite to use React Testing Library.

Links and resources
How to find enzyme usages

The list below was generated by searching for enzyme within files having names containing our test suffix:

https://user-images.githubusercontent.com/3360588/145886255-373f50c4-d3d3-4322-9963-bbea094192b4.mov

List of enzyme usages to be refactored:


Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
abbeyhrtcommented, Oct 18, 2022

Yeah!

Directions to use build-tests script:

  1. In your terminal, change directories to packages/react
  2. Run node tasks/build-test-rtl.js and choose the component you are wanting to create tests for. If for some reason, a file cannot be made, you will be prompted to copy the created tests if you want to paste them in the appropriate place.
  3. That command will create a new test file called <Component>-test.js--copy in the component’s directory. To get the test-runner to find the new tests, you will need to update the file name to <Component>-test.js and either rename or remove the currently existing test file.
1reaction
joshblackcommented, Dec 15, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrate from Enzyme | Testing Library
The primary purpose of React Testing Library is to increase confidence in your tests by testing your components in the way a user...
Read more >
Testing Overview - React
React Testing Library is a set of helpers that let you test React components without relying on their implementation details.
Read more >
How to use React Testing Library to rewrite an Enzyme ...
How to use React Testing Library to rewrite an Enzyme Component test. A mini-rewrite case study of two testing libraries. The Dream of ......
Read more >
Inside a dev's mind - Refactoring and debugging a React test
And once you start writing tests it may take hours to turn the dreaded red ... import { render, fireEvent } from "@testing-library/react";....
Read more >
How To Test Your React App With React Testing Library
We are using the latest CRA, so let's install this library. npm i --save-dev jest-environment-jsdom-sixteen. Inside the package.json ...
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