How to run Jest unit tests with Cocos creator version 3.8

I use Jest to write unit tests for my Cocos 3.8 project. When running the tests, I got an error like this:

Test suite failed to run

    Cannot find module 'cc' from 'myclass.test.ts'

    > 1 | import { log, Node} from 'cc';
        | ^

How should I configure Jest to work with Cocos 3.8?

1 Like

We have the same issues and still don’t find solution. It’s very frustrating that tests don’t work for files which refers engine…

I will be very grateful if anybody will post instruction how to solve it.

Also looking for a solution. Still not found good one :frowning_face: