Search code examples
node.jsjestjsstrapi

Unit tests never ending with jest and strapi


I'm using jest to develop my unit tests for strapi. In the strapi documentation (https://docs.strapi.io/developer-docs/latest/guides/unit-testing.html#testing-auth-endpoint-controller) they invite the developers to create one .test.js file that jest will discover and add all the tests files using requires.

The result is something like this :

it('strapi is defined', () => {
  expect(strapi).toBeDefined();
});
require('mytest1.js')
require('mytest2.js')
require('mytest3.js')

The problem is that I have, now, a lot of tests, and when I run this huge test file, the execution stops at 81 tests and webstorm display them like if they were still pending.

I tried many jest options like : --forceExit --detectOpenHandles --watchAll=false --no-watchman

But the problem is still there.

Help !


Solution

  • Hum, it seems that the problem came from one of my test that blocked all the process.