Skip to content

QuizNot attempted

shallow vs mount

Why has the ecosystem moved away from Enzyme's shallow() rendering?
1–4 to choose, Enter to submit
Show answer & explanation

Correct answer:

  • Shallow rendering tests implementation details (child components are stubbed), so tests break on refactors yet miss real integration bugs
  • shallow() stubs child components, so tests assert on component internals: they break on harmless refactors yet miss bugs in how parts integrate.
  • Testing Library renders the full tree into jsdom and tests what the user sees.
  • Not too slow: shallow is actually faster.
  • Not class components: it renders them fine.
  • Not needs a real browser: Enzyme runs in jsdom.