GithubHelp home page GithubHelp logo

Comments (6)

just-boris avatar just-boris commented on April 29, 2024 1

Updated Enzyme to 2.0 version and used jsdom setup from the documentation.

Now it works fine. Thank you!

from enzyme.

lelandrichardson avatar lelandrichardson commented on April 29, 2024

are you using jsdom? If so, perhaps try to ensure that the jsdom document get's loaded before you require enzyme or react... this might fix it.

I'm still trying to grapple with the different ways in which react depends on the document. It seems we need to add more unit tests where we have components that conditionally render.

from enzyme.

just-boris avatar just-boris commented on April 29, 2024

Bug is still here in the gist: https://gist.github.com/just-boris/35da18d27eccdf4b6780

I tried to require React as late as it possible.

from enzyme.

lelandrichardson avatar lelandrichardson commented on April 29, 2024

@just-boris i am going to spend some time over the holiday trying to figure this out. This is a thorny problem that doesn't have an obvious solution :/

from enzyme.

lelandrichardson avatar lelandrichardson commented on April 29, 2024

Going to close this issue now. This invariant violation should not happen if you provide enzyme access to a global document before requiring react for the first time.

from enzyme.

Lian1230 avatar Lian1230 commented on April 29, 2024

Exactly, like I use AVA, require jsdom and enzyme in order:
“require”: [ “./test/config/setup-1-jsdom”, “./test/config/setup-2-enzyme” ]

from enzyme.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.