syncfusion / ej2-angular-ui-components

Syncfusion Angular UI components library offer more than 50+ cross-browser, responsive, and lightweight angular UI controls for building modern web applications.
https://www.syncfusion.com/angular-ui-components
Other
276 stars 114 forks source link

Issues with Jest and mjs files #241

Closed TheDevelolper closed 2 years ago

TheDevelolper commented 2 years ago

Hello,

I'm trying to use Syncfusion in our Nx Angular application which uses jest for testing. However because sync fusion grid seems to be using mjs files the tests are failing with:

SyntaxError: Cannot use import statement outside a module

My current jest config contains the following but it just doesn't work:

 moduleFileExtensions: ["ts", "js", "mjs"],
  transform: {
    '^.+\\.(ts|js|mjs|html)$': 'jest-preset-angular'
  },
  transformIgnorePatterns: [
    'node_modules/(?!.*.mjs$|@ckeditor)'
  ],

Can someone please help?

rajapandiyan-settu commented 2 years ago

Hi,

Thanks for contacting Syncfusion support.

Query: SyntaxError: Cannot use import statement outside a module

The reported query is a common issue and it is not related to Syncfusion components. Kindly refer to the following public links to resolve this problem.

https://stackoverflow.com/questions/58613492/how-to-resolve-cannot-use-import-statement-outside-a-module-in-jest https://stackoverflow.com/questions/61781271/jest-wont-transform-the-module-syntaxerror-cannot-use-import-statement-outsi https://stackoverflow.com/questions/59709939/jest-cannot-use-import-statement-outside-a-module https://stackoverflow.com/questions/66483940/syntaxerror-cannot-use-import-statement-outside-a-module-error-while-testing https://stackoverflow.com/questions/59879689/jest-syntaxerror-cannot-use-import-statement-outside-a-module https://www.querythreads.com/how-to-resolve-cannot-use-import-statement-outside-a-module-in-jest/

Regards, Rajapandiyan S

syncsiva commented 2 years ago

This issue has been closed due to no response from the original author. Please feel free to reopen, if you have more information that can help us investigate the issue further.