以下のMocha/Chainスタートアップブロックでテストすると、コードは期待どおりに待機しません。代わりに、ログは作成の開始を報告し、テストからログをとり(含まれていない)、インデックスの作成が完了したことを報告します。ElasticSearch JavaScript Promises
プロミスが却下されるか拒絶されるまで、各ブロックの前にモカが出てはならないのですか?
私は何が欠けていますか?
module.exports.prototype.setup = function (term) {
this.logger.info("Re-creating the index '%s'", $index);
return this.client.indices.delete({
index: $index,
ignore: [404]
}).then((err, resp, respcode) => {
this.logger.info("Creating index '%s'", $index);
return this.client.indices.create({
index: $index,
body: this.schemaBody
});
});
};
約束はブロックされていません。それらは同期していない非同期です。 –