vendredi 8 février 2019

Jest not close()ing expressjs server when run on AWS Codebuild

When I run locally jest exits fine, but when run on codebuild jest will not exit and gives this error:

Jest has detected the following 1 open handle potentially keeping Jest from exiting:

● TCPSERVERWRAP

  13 | routes(app) 
  14 |  
> 15 | app.listen(port, async err => { 

Both these variants work locally but not on codebuild:

  afterAll((done) => {
    if (app) {
      app.close(done);
    }
  })

  afterAll(async () => {
    if (app) {
      await app.close()      
    }
  })

Using process.exit(0) does not help

Aucun commentaire:

Enregistrer un commentaire