I use GitLab cloud CI to run Jest tests on my node project and after deploy the app to AWS. It happened now quite frequently (1/3) that after all the tests completes during the first job the runner hangs and doesn’t move to the next job (deployment).
It hangs here:
until the runner timeout kicks and makes it fail.
This happened once or twice a while ago but became all of a sudden quite frequent. Maybe around the time I started mocking dates on the server for testing in particular dates (I use both SinonFakeTimers and jest.spyOn(global.Date, ‘now’).mockImplementationOnce).
It is mostly an end-to-end test and besides the main image we use a postgis service. This is the job that hangs:
build:
stage: build
allow_failure: false
services:
- postgis/postgis:11-2.5
script:
- npm install --quiet
- npm run build
- find ./build/db/migrations -name '*.map' -delete
- NODE_ENV=ci ./node_modules/.bin/sequelize db:migrate --migrations-path ./build/db/migrations
- NODE_ENV=ci npm run test # which runs: jest --no-cache --detectOpenHandles
artifacts:
paths:
- build
How could I debug such problem?
Thank you so much for any help!