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.

Un-report react-test-renderer's findByType & findAllByType queries as async.

See original GitHub issue

What rule do you want to change?

await-async-query

Does this change cause the rule to produce more or fewer warnings?

Fewer warnings

How will the change be implemented?

Check that given node does not end with ‘ByType’.

Example code

const elements = root.findAllByType('div')

How does the current rule affect the code?

promise returned from `findAllByType` query must be handled

How will the new rule affect the code?

This rule will not be applied if the query ends with ‘ByType’.

Anything else?

No response

Do you want to submit a pull request to change the rule?

Yes

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Belco90commented, Oct 11, 2022

So you’re basically saying these are two separate things, right? Reports of react-test-renderer should be avoided even without this PR, right?

Yes. I’ve created #673 to stop reporting utils from react-test-renderer.

0reactions
Belco90commented, Dec 26, 2022

Closing in favor of #673

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-test-renderer: promise returned from `findByProps` query ...
Steps To Reproduce. create a ReactTestInstance using create from react-test-renderer · The current behavior. Eslint(testing-library/await-async- ...
Read more >
Test Renderer - React
This package provides a React renderer that can be used to render React components to pure JavaScript objects, without depending on the DOM...
Read more >
Testing Library findBy* queries only working with async/await
But it seems like using these queries with Promise.prototype.catch() doesn't work in cases where using them with async/await + try...catch ...
Read more >
react-test-renderer.ReactTestInstance.findAllByType ... - Tabnine
Similar to `ReactDOM.render` but it doesn't require DOM and only renders a single level deep. ReactTestRenderer.toJSON · ReactTestInstance.props, ...
Read more >
TDD with React Test Renderer - LogRocket Blog
root; // [ 3 ] query for element const element = root.findByType("div"); // [ 4 ] assert that ...
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