Is there a way to get Chai working with asynchronous Mocha tests?

后端 未结 13 2181
自闭症患者
自闭症患者 2020-11-29 21:06

I\'m running some asynchronous tests in Mocha using the Browser Runner and I\'m trying to use Chai\'s expect style assertions:

window.expect = chai.expect;
d         


        
13条回答
  •  暖寄归人
    2020-11-29 21:34

    Try chaiAsPromised! Aside from being excellently named, you can use statements like:

    expect(asyncToResultingValue()).to.eventually.equal(true)

    Can confirm, works very well for Mocha + Chai.

    https://github.com/domenic/chai-as-promised

提交回复
热议问题