GDATASoftwareAG / vaas

Verdict-as-a-Service SDKs: Analyze files for malicious content
https://www.gdata.de/business/security-services/verdict-as-a-service
MIT License
36 stars 10 forks source link

Jest detects open handles #602

Closed doxthree closed 1 month ago

doxthree commented 2 months ago

When running Jest for the tests, you can check, if there are any open handles.

jest --forceExit --detectOpenHandles

While runnning, Jest is able to detect 3 open handles:

`Jest has detected the following 3 open handles potentially keeping Jest from exiting:

● TCPWRAP

  67 |   debug = false;
  68 |
> 69 |   constructor(private webSocketFactory = (url: string) => new WebSocket.WebSocket(url)) {
     |                                                           ^
  70 |     this.verdictPromises = new Map<string, VerdictPromise>();
  71 |   }
  72 |

  at Object.tlsConnect [as createConnection] (node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/websocket.js:1071:14)
  at initAsClient (node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/websocket.js:868:28)
  at new WebSocket (node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/websocket.js:88:7)
  at Vaas.webSocketFactory (src/Vaas.ts:69:59)
  at src/Vaas.ts:299:23
  at Vaas.connect (src/Vaas.ts:298:12)
  at tests/test.ts:84:33
  at tests/test.ts:31:71
  at Object.<anonymous>.__awaiter (tests/test.ts:27:12)
  at tests/test.ts:84:21
  at tests/test.ts:84:58
  at tests/test.ts:31:71
  at Object.<anonymous>.__awaiter (tests/test.ts:27:12)
  at Object.<anonymous> (tests/test.ts:80:82)

● TCPWRAP

  67 |   debug = false;
  68 |
> 69 |   constructor(private webSocketFactory = (url: string) => new WebSocket.WebSocket(url)) {
     |                                                           ^
  70 |     this.verdictPromises = new Map<string, VerdictPromise>();
  71 |   }
  72 |

  at Object.tlsConnect [as createConnection] (node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/websocket.js:1071:14)
  at initAsClient (node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/websocket.js:868:28)
  at new WebSocket (node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/websocket.js:88:7)
  at Vaas.webSocketFactory (src/Vaas.ts:69:59)
  at src/Vaas.ts:299:23
  at Vaas.connect (src/Vaas.ts:298:12)
  at tests/test.ts:382:35
  at tests/test.ts:31:71
  at Object.<anonymous>.__awaiter (tests/test.ts:27:12)
  at tests/test.ts:382:23
  at tests/test.ts:382:62
  at tests/test.ts:31:71
  at Object.<anonymous>.__awaiter (tests/test.ts:27:12)
  at Object.<anonymous> (tests/test.ts:379:58)

● TLSWRAP

  13 |
  14 |   const instance = axios.default.create();
> 15 |   const response = await instance.post(tokenEndpoint, formData, {
     |                                   ^
  16 |     headers: { "Content-Type": "application/x-www-form-urlencoded" },
  17 |   });
  18 |   return response.data.access_token;

  at RedirectableRequest.Object.<anonymous>.RedirectableRequest._performRequest (node_modules/.pnpm/follow-redirects@1.15.6/node_modules/follow-redirects/index.js:326:24)
  at new RedirectableRequest (node_modules/.pnpm/follow-redirects@1.15.6/node_modules/follow-redirects/index.js:100:8)
  at Object.request (node_modules/.pnpm/follow-redirects@1.15.6/node_modules/follow-redirects/index.js:532:14)
  at dispatchHttpRequest (node_modules/.pnpm/axios@1.7.7/node_modules/axios/lib/adapters/http.js:464:21)
  at node_modules/.pnpm/axios@1.7.7/node_modules/axios/lib/adapters/http.js:152:5
  at wrapAsync (node_modules/.pnpm/axios@1.7.7/node_modules/axios/lib/adapters/http.js:132:10)
  at http (node_modules/.pnpm/axios@1.7.7/node_modules/axios/lib/adapters/http.js:170:10)
  at Axios.dispatchRequest (node_modules/.pnpm/axios@1.7.7/node_modules/axios/lib/core/dispatchRequest.js:51:10)
  at Axios._request (node_modules/.pnpm/axios@1.7.7/node_modules/axios/lib/core/Axios.js:173:33)
  at Axios.request (node_modules/.pnpm/axios@1.7.7/node_modules/axios/lib/core/Axios.js:40:25)
  at Axios.httpMethod [as post] (node_modules/.pnpm/axios@1.7.7/node_modules/axios/lib/core/Axios.js:212:19)
  at Function.wrap (node_modules/.pnpm/axios@1.7.7/node_modules/axios/lib/helpers/bind.js:5:15)
  at src/getTokenWithClientCredentialsGrant.ts:15:35
  at src/getTokenWithClientCredentialsGrant.ts:31:71
  at Object.<anonymous>.__awaiter (src/getTokenWithClientCredentialsGrant.ts:27:12)
  at getTokenWithClientCredentialsGrant (src/getTokenWithClientCredentialsGrant.ts:42:12)
  at ClientCredentialsGrantAuthenticator.getToken (src/ClientCredentialsGrantAuthenticator.ts:11:46)
  at tests/test.ts:49:35
  at tests/test.ts:31:71
  at Object.<anonymous>.__awaiter (tests/test.ts:27:12)
  at createVaasWithClientCredentialsGrantAuthenticator (tests/test.ts:70:12)
  at tests/test.ts:358:28
  at tests/test.ts:31:71
  at Object.<anonymous>.__awaiter (tests/test.ts:27:12)
  at Object.<anonymous> (tests/test.ts:357:58)

`