arangodb / arangojs

The official ArangoDB JavaScript driver.
https://arangodb.github.io/arangojs
Apache License 2.0
600 stars 106 forks source link

Jest detecting open handles #801

Closed robross0606 closed 7 months ago

robross0606 commented 7 months ago

When I migrated from 7.x to 8.x, Jest started flagging several things as leaving "open handles" for TCPWRAP. For example:

  ●  TCPWRAP

      332 |     const collection = this.arangodb.collection(fullCollectionName)
      333 |
    > 334 |     const exists = await collection.exists()
          |                                     ^
      335 |     if (!exists && createIfMissing) {
      336 |       await collection.create({
      337 |         type: isEdge ? CollectionType.EDGE_COLLECTION : CollectionType.DOCUMENT_COLLECTION

      at Array.request (node_modules/src/lib/request.node.ts:158:57)
      at Connection._runQueue (node_modules/src/connection.ts:735:51)
      at node_modules/src/connection.ts:1036:12
      at Connection.request (node_modules/src/connection.ts:978:12)
      at Database.request (node_modules/src/database.ts:2036:29)
      at Collection.get (node_modules/src/collection.ts:3478:21)
      at Collection.exists (node_modules/src/collection.ts:3485:18)
robross0606 commented 7 months ago

So far, it is flagging open handles for both Collection.exists() and Database.query().

robross0606 commented 7 months ago

Forgot to mention that I also tried calling Database.close() but that had no effect on Jest open handle detection.

robross0606 commented 7 months ago

I think I figured this one out. I had to call Database.close() between each test. Not just after all of them were done.