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

后端 未结 13 2167
自闭症患者
自闭症患者 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:19

    You can also use domain module. For example:

    var domain = require('domain').create();
    
    domain.run(function()
    {
        // place you code here
    });
    
    domain.on('error',function(error){
        // do something with error or simply print it
    });
    

提交回复
热议问题