如何检查 chai 中的一系列错误?

How can one check an array of errors in chai?

现在我希望从 do 中抛出一些东西。但这不是一个错误,因为它是一个错误数组,每个错误不仅有一条消息,还有其他必须检查的属性。

expect(() => do(something)).to.throw()

使用 .property 我可以检查属性,但是如何使用数组甚至只是数组的第一个元素来检查属性?

好的,我有事要做。但是感觉不太对。

(使用 chai-each)

// setup
const f = () => do(something)

// assert the message in each error
expect(f).to.throw().and.to.each.have.property('message').which.eqls('No line breaks are allowed.')

// assert another property in each error
expect(f).to.throw().and.to.each.have.property('character').which.eqls(5)

有没有办法同时检查多个属性,或者只是以某种方式与同一错误的实例深度相等 class?或者甚至可以让这更简单一点?