mochaで単一のテストケースのタイムアウトを増やす方法 質問する

mochaで単一のテストケースのタイムアウトを増やす方法 質問する

テストケースでネットワーク要求を送信していますが、これには 2 秒 (デフォルトのタイムアウト) 以上かかることがあります。

単一のテスト ケースのタイムアウトを増やすにはどうすればよいですか?

ベストアンサー1

どうぞ:http://mochajs.org/#テストレベル

it('accesses the network', function(done){
  this.timeout(500);
  [Put network code here, with done() in the callback]
})

矢印関数の場合は次のように使用します。

it('accesses the network', (done) => {
  [Put network code here, with done() in the callback]
}).timeout(500);

おすすめ記事