0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Jestの実行が止まらない問題

Posted at

微妙に詰まったので備忘録的に

dbをテストするコードを書いてtestを実行してみると、成功はするものの実行が終わらない状態に

どうやら接続を切らないとずっと待ち受けちゃうらしい

describe('データベースをテストするサンプルコード', () => {

    let transaction;

    beforeEach(async () => {
        transaction = await sequelize.transaction()
    });

    afterEach(async () => {
        await transaction.rollback()

        // ここが必要
        await sequelize.close()
    });
});

これ以外にも、lisnarを起動する系のものは同じことが発生するらしい

jestの問題なのかdbの問題なのか非同期処理の問題なのか切り分けができなくて詰まってた

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?