viclafouch / mui-tel-input

📌 A phone number input designed for MUI (Material ui) V6 built with libphonenumber-js
https://viclafouch.github.io/mui-tel-input
MIT License
158 stars 65 forks source link

Jest - SyntaxError: Cannot use import statement outside a module #123

Closed syanaputra closed 7 months ago

syanaputra commented 7 months ago

Hi, I'm having an issue running a unit test using jest with this mui-tel-input package.

Has anyone faced the same issue?


Issue Details

Version: 5.0.0

Issue:

({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import { jsx as N, jsxs as H, Fragment as Fe } from "react/jsx-runtime";
                                                                                      ^^^^^^

    SyntaxError: Cannot use import statement outside a module

      15 |   lastName: string;
      16 |   telephone: string;
    > 17 |   mobile: string;
         |                      ^
      18 |   position: string;
      19 | };
      20 |

      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1505:14)
      at Object.<anonymous> (src/features/myprofile/editprofileform/EditProfileForm.tsx:17:22)
      at Object.<anonymous> (src/features/myprofile/editprofileform/EditProfileForm.test.tsx:6:26)

Project Details:

viclafouch commented 7 months ago

Duplicate with https://github.com/viclafouch/mui-tel-input/issues/89