inflearn logo
강의

Khóa học

Chia sẻ kiến thức

Phát triển TDD bằng cách theo dõi và học hỏi [cập nhật 2023.11]

Viết cập nhậtKiểm thử tích hợp sản phẩm (1)

Jest did not exit one second after the test run has completed. 이슈

3039

dyonglove

39 câu hỏi đã được viết

0

안녕하세요!!

 

npm test를 하면 끝부분에 항상 다음과 같은 메세지가 나오는데요,

>>>>>Ran all test suites.

Jest did not exit one second after the test run has completed.

 

This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.

^C

<<<<<<<

위 문제를 해결해주기 위해 package.json을 다음과 같이 설정해주면,

>>>>>>>

"scripts": {
"test": "jest --detectOpenHandles"
},

<<<<<<<<

위에 나왔던 메세지 대신에 아래와같은 에러 메세지가 나옵니다.

>>>>>>>>>

 

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

 

  ●  TCPWRAP

 

       9 | const mongoose = require('mongoose');

      10 |

    > 11 | mongoose.connect(

         |          ^

      12 |   'mongodb://127.0.0.1:27017/tdd-test',

      13 |   {

      14 |     useNewUrlParser: true,

 

      at makeConnection (node_modules/mongodb/src/cmap/connect.ts:395:18)

      at connect (node_modules/mongodb/src/cmap/connect.ts:61:3)

      at checkServer (node_modules/mongodb/src/sdam/monitor.ts:300:10)

      at node_modules/mongodb/src/sdam/monitor.ts:341:5

      at executeAndReschedule (node_modules/mongodb/src/utils.ts:1026:5)

      at makeInterruptibleAsyncInterval (node_modules/mongodb/src/utils.ts:1033:5)

      at Monitor.connect (node_modules/mongodb/src/sdam/monitor.ts:147:54)

      at Server.connect (node_modules/mongodb/src/sdam/server.ts:236:22)

      at createAndConnectServer (node_modules/mongodb/src/sdam/topology.ts:907:10)

      at node_modules/mongodb/src/sdam/topology.ts:921:22

          at Array.reduce (<anonymous>)

      at connectServers (node_modules/mongodb/src/sdam/topology.ts:919:43)

      at Topology.connect (node_modules/mongodb/src/sdam/topology.ts:438:5)

      at createTopology (node_modules/mongodb/src/operations/connect.ts:97:12)

      at connect (node_modules/mongodb/src/operations/connect.ts:52:10)

      at node_modules/mongodb/src/mongo_client.ts:432:14

      at maybePromise (node_modules/mongodb/src/utils.ts:609:3)

      at MongoClient.connect (node_modules/mongodb/src/mongo_client.ts:431:24)

      at node_modules/mongoose/lib/connection.js:796:12

      at NativeConnection.Object.<anonymous>.Connection.openUri (node_modules/mongoose/lib/connection.js:781:19)

      at node_modules/mongoose/lib/index.js:340:10

      at node_modules/mongoose/lib/helpers/promiseOrCallback.js:32:5

      at promiseOrCallback (node_modules/mongoose/lib/helpers/promiseOrCallback.js:31:10)

      at Mongoose.Object.<anonymous>.Mongoose._promiseOrCallback (node_modules/mongoose/lib/index.js:1140:10)

      at Mongoose.connect (node_modules/mongoose/lib/index.js:339:20)

      at Object.<anonymous> (server.js:11:10)

      at Object.<anonymous> (test/itegration/product.int.test.js:2:13)

 

<<<<<<<<<

 

이런 에러나 메세지가 나오지 않도록 조치할 수 있는 방법이 있을까요?

 

감사합니다.

 

 

 

 

nodejs mongodb tdd supertest express mongoose jest

Câu trả lời 3

1

John Ahn

안녕하세요 쭁님 

항상 열공하시네요!! 

이 부분에 답변은 

https://www.inflearn.com/questions/437973 

여기 한번 참조해 주실 수 있을까요? 

감사합니다!

0

builiengrdrohcgmzcahu70

In this five-minute game, the slight variations in your shots will be blown up into enormous monsters. Come discover more buried treasures! we become what we behold is a fun and enlightening game with an endless news cycle.

0

dyonglove

답변 감사드립니다!!

TypeError: user_model_1.default.create is not a function

0

253

1

에러 처리를 위한 단위테스트 작성

0

344

1

res.status(201) 부분에서 typeerror가 발생합니다

0

387

1

따라하며 배우는 TDD 개발 [2023.11 업데이트] 강의 질문

0

333

1

[MAC] PORT:5000번 관련 에러

0

272

0

테스트를 위한 데이터베이스를 생성해야하나요?

0

401

1

Postman 사용방법에 대해서

0

400

1

jest.fn() 을 할당할때 타입스크립트에서 에러가 발생합니다.

0

443

1

라우터를 돌릴 때

0

352

1

npm run start를 실행할 때 부터가 이상합니다.

1

431

1

node.js에 대한 이상점

0

453

1

nodemocks 오류나니까 뺴고 설치하셔요

1

409

1

Node.js 앱을 테스트하기 위한 Jest 설정 부분..

0

271

0

models 파일만 첫번째 글자를 대문자로 해주는 이유

0

297

1

mongodb project 및 cluster관련

0

327

0

무조건 failure case 로 넘어가시는 분들

2

258

1

올려둔 ES6 Express Jest Boilerplate Template 으로 개발 중이신 분들...

0

236

0

ES6 사용하고 싶은 분들...

1

359

0

왜 인자네개 함수 안만들어도 포스트맨에서는 에러메세지가 나오는 것인가요?

0

300

2

통합 테스트에 관한 질문 이 있습니다.

0

239

1

bodyParser 대체에 관한 질문

0

420

2

Cannot log after tests are done. Did you forget to wait for something async in your test?

0

2119

1

안녕하세요. 문의드립니다.

0

199

1

mock 사용 관련

0

162

0