格式化chai.expect错误中的对象 [英] Formatting objects in chai.expect errors

查看:142
本文介绍了格式化chai.expect错误中的对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当测试失败时,我要使用expect(x).to.deep.equal(y)比较两个对象,我想在浏览器测试报告中查看实际值.相反,我看到这样的东西:

When test fails, where I'm comparing two objects using expect(x).to.deep.equal(y), I'd like to see the actual values in my browser test report. Instead, I see something like this:

AssertionError: expected { Object (x, y, ...) } to deeply equal { Object (x, y, ...) }

因此它并没有真正显示出有用的信息.

So it doesn't really show anything useful.

是否可以自定义chai.js如何格式化这些对象?

Is there a way to customize how chai.js formats these objects?

推荐答案

您现在可以按照 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆