我在让Chai的expect.to.throw在我的node.js应用程序测试中工作时遇到问题。测试在抛出的错误上一直失败,但是如果我将测试用例包装在try中并捕获并断言捕获的错误,它就可以工作。expect.to.throw不能像我认为的那样工作吗?it('shouldthrowanerrorifyoutrytogetanundefinedproperty',function(done){varparams={a:'test',b:'test',c:'test'};varmodel=newTestModel(MOCK_REQUEST,params);//neitherofthesew
我在让Chai的expect.to.throw在我的node.js应用程序测试中工作时遇到问题。测试在抛出的错误上一直失败,但是如果我将测试用例包装在try中并捕获并断言捕获的错误,它就可以工作。expect.to.throw不能像我认为的那样工作吗?it('shouldthrowanerrorifyoutrytogetanundefinedproperty',function(done){varparams={a:'test',b:'test',c:'test'};varmodel=newTestModel(MOCK_REQUEST,params);//neitherofthesew