react-testing-library icon indicating copy to clipboard operation
react-testing-library copied to clipboard

feat(pure): add renderOptions support to render

Open naorpeled opened this issue 1 year ago • 6 comments

What:

Why:

How:

Checklist:

  • [ ] Documentation added to the docs site
  • [x] Tests
  • [x] TypeScript definitions updated
  • [ ] Ready to be merged

closes 1297

naorpeled avatar Jun 01 '24 19:06 naorpeled

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit faba7c10171b1966c145d39a6208c55721d8349d:

Sandbox Source
react-testing-library-examples Configuration

codesandbox-ci[bot] avatar Jun 01 '24 19:06 codesandbox-ci[bot]

We should flatten this instead of allowing arbitrary options. We don't know if a passing all through will make sense. If people want to access the root options directly, they can always switch to createRoot directly.

eps1lon avatar Jun 02 '24 00:06 eps1lon

We should flatten this instead of allowing arbitrary options. We don't know if a passing all through will make sense. If people want to access the root options directly, they can always switch to createRoot directly.

how should we handle the cases where the consumer uses the non-canary version that currently does not expose those options?

naorpeled avatar Jun 10 '24 21:06 naorpeled

how should we handle the cases where the consumer uses the non-canary version that currently does not expose those options?

Is there something different in that regard between your initial version and the version I proposed?

eps1lon avatar Jun 11 '24 07:06 eps1lon

how should we handle the cases where the consumer uses the non-canary version that currently does not expose those options?

Is there something different in that regard between your initial version and the version I proposed?

First of all, sorry for the delayed response.

Afaik it's different in the sense that we base the type definitions on what the version the consumer uses, in React 18 they won't get type autocompletions for v19 canary definitions, and vice verse.

naorpeled avatar Jun 22 '24 00:06 naorpeled

Afaik it's different in the sense that we base the type definitions on what the version the consumer uses, in React 18 they won't get type autocompletions for v19 canary definitions, and vice verse.

That's intended though, no? I don't see how type concerns need to dictate our API. It seems to me we can make flat options work. It just requires a bit more type-implementation work on our part.

eps1lon avatar Jun 25 '24 08:06 eps1lon

Alternate: https://github.com/testing-library/react-testing-library/pull/1354

eps1lon avatar Aug 28 '24 20:08 eps1lon

Alternate: https://github.com/testing-library/react-testing-library/pull/1354

Sorry I ended up not finishing this task, had some IRL things to deal with.

Thanks for taking this task, I should've communicated earlier.

naorpeled avatar Aug 28 '24 21:08 naorpeled