Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

82
Visualizações
Using Jest with ReactDOM.findDOMNode

Jest (technically, Jest snapshot testing with ReactTestRenderer) does not work with ReactDOM.findDOMNode.

I've seen where I can work around this using Jest mocks. For example, if my ChannelScanner component uses my RadioButtonSet component, which wraps react-widgets' SelectList, then putting the following code in ChannelScanner.test.js allows snapshot testing to work:

jest.mock('../../src/components/forms/RadioButtonSet', () => 'RadioButtonSet');

However, this seems to break encapsulation: RadioButtonSet's tests have to set up mocks based on the components it uses, and the transitive components that they use, and this work has to be repeated for every component.

What's the best way to handle this? Short of enabling automock, is there a good way to say, "This module knows that it needs to mock itself whenever it appears?"

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda