Javascript MySQL池阻止Jest退出
我正在使用NodeJS的MySQL库。我有一个指定的池:Javascript MySQL池阻止Jest退出,javascript,mysql,node.js,jestjs,Javascript,Mysql,Node.js,Jestjs,我正在使用NodeJS的MySQL库。我有一个指定的池: import mysql from 'mysql'; const pool = mysql.createPool({ connectionLimit : 2, host : config.host, user : config.user, password : config.password, database : config.databas
import mysql from 'mysql';
const pool = mysql.createPool({
connectionLimit : 2,
host : config.host,
user : config.user,
password : config.password,
database : config.database
});
export default pool;
我的Jest测试调用从池中获取连接的函数,并且所有测试都成功完成
然而,玩笑本身并不存在。我注意到这个信息:
Jest has detected the following 1 open handle potentially keeping Jest from exiting:
● TCPWRAP
49 | async getRecords(): Promise<boolean> {
50 | return new Promise((resolve, reject) => {
> 51 | pool.query(
Jest检测到以下1个打开的句柄可能会阻止Jest退出:
● TCPWRAP
49 |异步getRecords():承诺{
50 |返回新承诺((解决、拒绝)=>{
>51 | pool.query(
它正在抱怨pool.query连接。但是,MySQL模块正在管理池中的连接。当连接被利用时,它会被库释放
那我怎么才能让玩笑退出呢