deepl-node
deepl-node copied to clipboard
[tests] Jest may incorrectly detect open handles when running the tests
Describe the bug See fix in jest: https://github.com/jestjs/jest/pull/13414 Unfortunately, this version of Jest (29.2+) requires Node 14.
To Reproduce In the console, running tests may give a warning similar to the following
$ node_modules/.bin/jest --detectOpenHandles --no-cache tests/
PASS tests/general.test.ts
PASS tests/glossary.test.ts (24.288 s)
PASS tests/translateDocument.test.ts (31.975 s)
PASS tests/translateText.test.ts (6.858 s)
Test Suites: 4 passed, 4 total
Tests: 11 skipped, 50 passed, 61 total
Snapshots: 0 total
Time: 66.442 s
Ran all test suites matching /tests\//i.
Jest has detected the following 2 open handles potentially keeping Jest from exiting:
● TLSWRAP
220 | ): Promise<{ statusCode: number; content: TContent }> {
221 | try {
> 222 | const response = await axios.request(axiosRequestConfig);
| ^
223 |
224 | if (axiosRequestConfig.responseType === 'text') {
225 | // Workaround for axios-bug: https://github.com/axios/axios/issues/907
at node_modules/nock/lib/intercept.js:427:16
at Object.module.request (node_modules/nock/lib/common.js:96:14)
at RedirectableRequest.Object.<anonymous>.RedirectableRequest._performRequest (node_modules/follow-redirects/index.js:284:24)
at new RedirectableRequest (node_modules/follow-redirects/index.js:66:8)
at Object.request (node_modules/follow-redirects/index.js:523:14)
at dispatchHttpRequest (node_modules/axios/lib/adapters/http.js:436:21)
at node_modules/axios/lib/adapters/http.js:143:5
at wrapAsync (node_modules/axios/lib/adapters/http.js:123:10)
at http (node_modules/axios/lib/adapters/http.js:149:10)
at Axios.dispatchRequest (node_modules/axios/lib/core/dispatchRequest.js:51:10)
at Axios.request (node_modules/axios/lib/core/Axios.js:148:33)
at Function.wrap [as request] (node_modules/axios/lib/helpers/bind.js:5:15)
at Function.sendAxiosRequest (src/client.ts:222:42)
at HttpClient.sendRequestWithBackoff (src/client.ts:176:45)
at Translator.translateText (src/index.ts:571:63)
at Object.<anonymous> (tests/translateText.test.ts:19:41)
at TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:333:13)
at runJest (node_modules/@jest/core/build/runJest.js:404:19)
at _run10000 (node_modules/@jest/core/build/cli/index.js:320:7)
at runCLI (node_modules/@jest/core/build/cli/index.js:173:3)
● TLSWRAP
220 | ): Promise<{ statusCode: number; content: TContent }> {
221 | try {
> 222 | const response = await axios.request(axiosRequestConfig);
| ^
223 |
224 | if (axiosRequestConfig.responseType === 'text') {
225 | // Workaround for axios-bug: https://github.com/axios/axios/issues/907
at node_modules/nock/lib/intercept.js:427:16
at Object.module.request (node_modules/nock/lib/common.js:96:14)
at RedirectableRequest.Object.<anonymous>.RedirectableRequest._performRequest (node_modules/follow-redirects/index.js:284:24)
at new RedirectableRequest (node_modules/follow-redirects/index.js:66:8)
at Object.request (node_modules/follow-redirects/index.js:523:14)
at dispatchHttpRequest (node_modules/axios/lib/adapters/http.js:436:21)
at node_modules/axios/lib/adapters/http.js:143:5
at wrapAsync (node_modules/axios/lib/adapters/http.js:123:10)
at http (node_modules/axios/lib/adapters/http.js:149:10)
at Axios.dispatchRequest (node_modules/axios/lib/core/dispatchRequest.js:51:10)
at Axios.request (node_modules/axios/lib/core/Axios.js:148:33)
at Function.wrap [as request] (node_modules/axios/lib/helpers/bind.js:5:15)
at Function.sendAxiosRequest (src/client.ts:222:42)
at HttpClient.sendRequestWithBackoff (src/client.ts:176:45)
at Translator.translateText (src/index.ts:571:63)
at Object.<anonymous> (tests/translateText.test.ts:221:41)
at TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:333:13)
at runJest (node_modules/@jest/core/build/runJest.js:404:19)
at _run10000 (node_modules/@jest/core/build/cli/index.js:320:7)
at runCLI (node_modules/@jest/core/build/cli/index.js:173:3)
Expected behavior Tests should run without throwing warnings.