With Konva and react-konva installed and imported, my jest@enzyme tests failed to run with this error:
● Test suite failed to run
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
Details:
C:\avius\fortest\node_modules\konva\lib\Core.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){export { Konva } from './_CoreInternals.js';
^^^^^^
SyntaxError: Unexpected token 'export'
at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1350:14)
at Object.<anonymous> (node_modules/react-konva/lib/ReactKonvaCore.js:19:13)
it is a newly created create-react-app for testing this error, so there is nothing special in it. I have no babel.rc, nor babel.config.js or jest.config.js file. (because I tried a lot of setting, does not work.)
I can import and use other es6 modules like nanoid, lodash etc, so it seems that the konva needs something special? Uninstalling konva, everything working fine.