wnr / element-resize-detector

Optimized cross-browser resize listener for elements.
MIT License
1.32k stars 118 forks source link

Invalid arguments. Must be a DOM element or a collection of DOM elements #123

Closed casvil closed 4 years ago

casvil commented 4 years ago

The following error keeps appearing when I run jest snapshot testing. It is non-blocking though.

console.error node_modules/element-resize-detector/src/reporter.js:28 Invalid arguments. Must be a DOM element or a collection of DOM elements

System: Environment Info:

  System:
    OS: macOS Mojave 10.14.6
    CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
  Binaries:
    Node: 12.16.1 - ~/.meteor/packages/meteor-tool/.1.10.1.6yx87b.7o9xg++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/node
    Yarn: 1.22.4 - ~/.meteor/packages/meteor-tool/.1.10.1.6yx87b.7o9xg++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/yarn
    npm: 6.14.0 - ~/.meteor/packages/meteor-tool/.1.10.1.6yx87b.7o9xg++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/npm
  Browsers:
    Chrome: 81.0.4044.138
    Firefox: 75.0
    Safari: 12.1.2
  npmPackages:
    @storybook/addon-actions: ^5.3.18 => 5.3.18
    @storybook/addon-centered: ^5.3.18 => 5.3.18
    @storybook/addon-links: ^5.3.18 => 5.3.18
    @storybook/addon-storyshots: ^5.3.18 => 5.3.18
    @storybook/addon-storysource: ^5.3.18 => 5.3.18
    @storybook/addons: ^5.3.18 => 5.3.18
    @storybook/react: ^5.3.18 => 5.3.18
    @storybook/react-komposer: ^2.0.5 => 2.0.5
wnr commented 4 years ago

Can you provide a jsbin or similar with this case?

casvil commented 4 years ago

No, I am sorry I can not, the code is work-related. Basically the error appears in the console when I perform a snapshot with jest, no stack trace available :( just this console.error.

What does this error could mean? My component is a react-virtualized table and one of its cells has a react-sizeme component, just to tell you and see where the error could come from. Thanks

casvil commented 4 years ago

Any ideas on how this can happen?

wnr commented 4 years ago

Well, somehow the given element(s) are not valid DOM elements. Can't really tell how this is happening, but I assume it's something in your setup as this is working for several other projects. I'll need a minimal reproducible example to investigate it further. Can you provide such example?