Skip to content

About testing rendered elements in vitest/jest #1875

Answered by usualoma
PorcoRosso85 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @PorcoRosso85,

When working with "hono/jsx", I recommend referring to https://github.com/honojs/hono/tree/main/src/jsx and following these steps for testing. It's advised not to use "@testing-library/react" in this scenario.

  • Use toString() to convert to string
  • Use a library that emulates the DOM, such as JSDOM

On the other hand, if you're using React instead of hono/jsx, "@testing-library/react" is the preferred option.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@PorcoRosso85
Comment options

@PorcoRosso85
Comment options

Answer selected by PorcoRosso85
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants