agutoli / react-styled-select

A Select control built with Reactjs, styled-components and :heart: http://agutoli.github.io/
MIT License
108 stars 23 forks source link

Trying to test it with react-test-renderer does not work #20

Open vladejs opened 6 years ago

vladejs commented 6 years ago

Just importing the component gives error:

 ReferenceError: MutationObserver is not defined

      at Object.<anonymous> (node_modules/@webcomponents/shadydom/shadydom.min.js:16:377)
      at Object.<anonymous> (node_modules/@webcomponents/shadydom/shadydom.min.js:66:338)
      at Object.<anonymous>.Object.defineProperty.value (node_modules/react-styled-select/lib/Select/Select.js:5:986)
      at Object.<anonymous> (node_modules/react-styled-select/lib/Select/Select.js:13:3)
      at Object.<anonymous>.Object.defineProperty.value (node_modules/react-styled-select/lib/index.js:5:40)
      at Object.<anonymous> (node_modules/react-styled-select/lib/index.js:13:3)
      at Object.<anonymous> (src/components/common/select/select.js:2:26)
      at Object.<anonymous> (src/__tests__/select.test.js:5:15)
          at Generator.next (<anonymous>)
          at Promise (<anonymous>)
          at Generator.next (<anonymous>)
          at <anonymous>
      at process._tickCallback (internal/process/next_tick.js:188:7)
iansolano commented 6 years ago

Having this same problem. Any progress on this?

BTW: Quick solve was to downgrade the version (for anyone coming across this open issue).

agutoli commented 6 years ago

Hi, sorry about that, I will see it as soon as possible!

agutoli commented 6 years ago

@vladejs @iansolano I have not any info about how can I reproduce this problem, but I did some research about this error and I did some fixes, can you test it please?

If still have the problem, can you say what test engine are you using (Jest or mocha or karma)? React Versions etc?

Tks

agutoli commented 6 years ago

new version 2.2.5-beta

iansolano commented 6 years ago

@agutoli just tested, still the same error. Using Jest "jest": "20.0.4" and "react": "^16.2.0". Also tested with the latest stable release of jest 22.3.0 and received the same MutationObserver error.

The 2.1.2-alpha release works fine with my current configuration. Hopefully that helps. Thanks for following up.

agutoli commented 6 years ago

@iansolano I just did a new fix, can you try it please? tks

new version 2.2.6-beta

iansolano commented 6 years ago

@agutoli sorry about the delay. Still failing: image

image

This is the install from 2.1.2-alpha: image

I wonder if the version of react-shadow is a problem here? I don't know. Sorry, ATM I don't really have the time to look into this and help out. If I find some free time I'll try to take a look. Hopefully this helps.