react-resizable icon indicating copy to clipboard operation
react-resizable copied to clipboard

ESM build causes previously passing Jest tests to fail

Open Byron-Wall opened this issue 4 years ago • 2 comments

Thanks for opening an issue!

Please select the type of issue you're reporting. For questions.

  • [x ] Bug
  • [x ] Feature Request
  • [ ] Question

Problem Report

Please describe the problem here. Previously passing jest tests fail with the output:

Details:

node_modules/react-resizable/node_modules/react-draggable/build/Draggable.js:56
            prevPropsPosition: { ...position
                                 ^^^

    SyntaxError: Unexpected token ...

System Info

Node Version: 6.14.4 Browser: JSDOM OS: X

Reproduction

Run a jest test on a component that imports react-resizable

#######FIX############ the fix is: add react-resizable to the projects' jest config's transformIgnorePatterns, like so:

    "transformIgnorePatterns": [
      "<rootDir>/node_modules/(?!react-resizable)"
    ],

Byron-Wall avatar Oct 24 '19 14:10 Byron-Wall

I'd guess the feature request is really a docs PR, which I can do later if needed

Byron-Wall avatar Oct 24 '19 14:10 Byron-Wall

It does not seem to break only Jest but also breaks one of my older Electron app Am I expected to update something in my app for this to work? Maybe the Babel version?

Edit: finally got it by locking react-resizable to 1.8 explictely, when using react-grid-layout. Some older app won't be happy with the Babel 7 update, so they need to use this version before they update Babel themselves.

eric-burel avatar Dec 12 '19 16:12 eric-burel