Skip to content

MaxListenersExceededWarning occurs while testing with jest #6699

@kaito3desuyo

Description

@kaito3desuyo

Issue type:

[ * ] bug report
[ ] feature request
[ ] documentation issue

Database system/driver:

[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql / mariadb
[ ] oracle
[ * ] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo

TypeORM version:

[ * ] latest
[ ] @next
[ ] 0.x.x (or put your version here)

Steps to reproduce or a small repository showing the problem:

After updating typeorm to 0.2.26, I'm getting a lot of title errors when testing with jest. It does not occur at >=0.2.25.

$ node --trace-warnings node_modules/.bin/jest -i --config ./test/jest-e2e.js
(node:9509) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added to [Client]. Use emitter.setMaxListeners() to increase limit
    at _addListener (events.js:390:17)
    at Client.addListener (events.js:406:10)
    at Client.once (events.js:437:8)
    at PostgresQueryRunner.<anonymous> (/home/hoge-api/src/driver/postgres/PostgresQueryRunner.ts:174:36)
    at step (/home/hoge-api/node_modules/tslib/tslib.js:136:27)
    at Object.next (/home/hoge-api/node_modules/tslib/tslib.js:117:57)
    at fulfilled (/home/hoge-api/node_modules/tslib/tslib.js:107:62)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

I'm using NestJS 7.4.4 as the api framework, but this issue is only caused by different versions of TypeORM.
The jest version is 26.4.2, the ts-jest version is 26.3.0, and the supertest version is 4.0.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions