3cn-ecn / nantralPlatform

Nantral Platform is a website project for clubs, events and more in Centrale Nantes
https://nantral-platform.fr
MIT License
21 stars 2 forks source link

jest doesn't perfectly work #1000

Closed ErwanQui closed 1 year ago

ErwanQui commented 1 year ago

Due to ESM compatibility problem, jest can't run test on the Calendar component (and that can be the case of other imported modules, but not enough tests are implemented to see this).

image

Here the problem come from nanoid which is imported with "require" in the ics library

hydrielax commented 1 year ago

If it can be for any help, we have 3 ways to solve this problem.

What is the bug exactly?

Jest does not support ESM modules, ie the files which uses import ... from syntax instead of CommonJS (const ... = require(...)). These files must be transformed before giving them to jest.

How to solve?