resize-detector icon indicating copy to clipboard operation
resize-detector copied to clipboard

Cope with null document

Open camelpunch opened this issue 4 years ago • 0 comments

This can happen in unit tests, especially when using Jest with jsdom.

You may get warnings like:

    Cannot log after tests are done. Did you forget to wait for something async in your test?
        Attempted to log "Error: Uncaught [TypeError: Cannot read property 'documentElement' of null]

If we check for the existence of the document first, we can tidy up our test output.

camelpunch avatar Dec 07 '20 12:12 camelpunch