即使抛出错误,Jasmine toThrow也不起作用
即使发生错误,此代码也会失败。
it('should throw error when foo config value is falsey', (done) => { const config = { foo: null, bar: 'some-name' }; expect(quux.withConfig(config).load('*', (err, inst) => { done(); })).toThrow(); });
我也试过这个
it('should throw error when foo config value is falsey', (done) => { const config = { foo: null, bar: 'some-name' }; expect(SelfServiceCompletedJobStore.withConfig(config).load('*', (err, inst) => { })).toThrow(); done(); });
错误信息:
should throw error when foo config value is falsey - Error: Requires a non-empty foo:String
你应该将一个函数传递给expect(…)。 以下代码:
expect(quux.withConfig(config).load('*', (err, inst) => { done(); })).toThrow();
正在尝试将呼叫的结果传递给期望(…),
改用一个匿名函数:
expect(function(){ quux.withConfig(config).load('*', (err, inst) => { done(); }); }).toThrow();
- 量angular器:同一页面上的两个下拉菜单,只能从一个下拉菜单中成功select元素
- 量angular器:在上传过程中检查存在的元素
- Jasmine Nodetestingsubprocess
- unit testing使用服务方法的节点js控制器的最佳方法是什么?
- 什么是从节点使用茉莉花的正确方法?
- 如何使EXPECT条件等待承诺解决(代码包装在一个方法中)?
- 如何操作Jasmine JS在Webdriver的“文本”validation?
- 我如何testing我的asynchronous茉莉/ nodejs /诺言代码使用间谍
- 茉莉花+ Node.js服务器端unit testing。 如何运行testing?