Error: Invariant Violation: dangerouslyRenderMarkup(…): Cannot render markup in a worker thread

后端 未结 2 1571
梦谈多话
梦谈多话 2021-01-18 16:51

React Tests Fails after set State causes second render

Up until now testing has been going well with JSDOM and Mocha. So far have not had to test any components t

相关标签:
2条回答
  • 2021-01-18 17:26

    Insert your global object modifying(passing window and document objects to global) before React is required. Because React creates its ExecutionEnvironment object while required and don't modify it while works.

    0 讨论(0)
  • 2021-01-18 17:47

    The setup JSDOM setup was missing global.navigator.

    global.navigator = {
       userAgent: 'node.js'
    };
    
    0 讨论(0)
提交回复
热议问题