Open nikhilguptagl opened 8 months ago
Is there anything I can do to run my test cases sucessfully or the team needs to add "type": "module" in their package.json ?
The team (we) need to convert this library to ESM in order to fix this issue.
Even with this issue addressed you'd likely still run into issues testing bpmn-js in node. Consider to mock it or apply browser-based testing (including bundling).
While running test cases, I am getting below errors -
src/shared/components/BpmnEditor/tests/BpmnEditor.test.tsx [ src/shared/components/BpmnEditor/tests/BpmnEditor.test.tsx ] SyntaxError: Unexpected token 'export' ❯ Object.compileFunction node:vm:352:18 ❯ Object. node_modules/bpmn-js-properties-panel/lib/cmd/UpdateBusinessObjectHandler.js:4:10
Module D:/Repository/Hitachi/content-hub-ui/Frontend/author/node_modules/bpmn-js/lib/util/ModelUtil.js:9 seems to be an ES Module but shipped in a CommonJS package. You might want to create an issue to the package "bpmn-js" asking them to ship the file in .mjs extension or add "type": "module" in their package.json.
As a temporary workaround you can try to inline the package by updating your config:
However, I am also adding bpmn-js in vite.config but still it throws the same error. Is there anything I can do to run my test cases sucessfully or the team needs to add "type": "module" in their package.json ?