简体   繁体   English

浏览器中的Mocha:如何使用chai.assert获取报告

[英]Mocha in the browser: How to get a report using chai.assert

I can't get Mocha to produce output when using chai.assert. 使用chai.assert时,我无法让Mocha产生输出。 http://jsfiddle.net/web5me/244PT/6/ http://jsfiddle.net/web5me/244PT/6/

var assert = chai.assert();
mocha.setup('bdd');

describe('Kata', function() {
    it('should return...', function() {
        assert.equal(true, true, 'Truthy values should be treated equal.');
    });
});

mocha.run();

It works perfectly with chai.should and chai.expect. 它与chai.should和chai.expect完美配合。 http://jsfiddle.net/web5me/244PT/#base http://jsfiddle.net/web5me/244PT/#base

我认为您称断言错误,您是否尝试过

var assert = chai.assert;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Chai在Mocha框架中使用backstopjs断言失败 - How to Assert a Failure With backstopjs in a mocha framework using Chai 使用 Mocha 和 Chai 断言 RegExp - Assert RegExp with Mocha and Chai 使用Puppeteer,Mocha和Chai在html标记属性中存在文本 - Assert presence of text in an html tag attribute using Puppeteer, Mocha and Chai 困惑于如何正确声明KeystoneJS模型保存错误与Mocha + Chai - confused on how to properly assert a keystoneJS model save error with mocha + chai 我怎么能在使用mocha和chai的`new constructor()`时断言抛出 - how can I assert throw when `new constructor()` with mocha and chai 如何使用 Mocha/Chai/Protractor 单击复选框 - How to click on a checkbox using Mocha/Chai/Protractor 如何使用 mocha、chai 和量角器等待元素 - How to wait for element using mocha, chai & protractor 如何使用 chai 在 protractor 中断言 sendkeys? - How to assert sendkeys in protractor using chai? Mocha,Chai:断言Object包含在一个对象数组中 - Mocha, Chai: Assert that Object is included in an Array of Objects 检查数组是否是另一个数组的子集,并使用js / chai / mocha在断言失败的情况下最后列出所有差异 - Check if array is a subset of another array and list all the differences at the end with an assert failure using js/chai/mocha
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM