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
171 stars 66 forks source link

Test errors out after bumping to v 4.0.0 #89

Closed ManuC84 closed 1 year ago

ManuC84 commented 1 year ago

I'm getting this error when running my test suites that somehow are related to mui-tel-input after bumping to latest version.

 SyntaxError: Cannot use import statement outside a module

    > 1 | import { MuiTelInput, matchIsValidTel } from "mui-tel-input";
        |                                                             ^
      2 | import { useState } from "react";
      3 | import { Controller } from "react-hook-form";
      4 | import { useRouter } from "next/router";

      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1728:14)
      at Object.<anonymous> (components/inputs/Input/components/SelectPhone.tsx:1:61)

Any ideas why this could be? Doesn't happen with 2.0.4

viclafouch commented 1 year ago

Hello !

The package is in ESM only, so you have to tell jest to allow ESM package.