码迷,mamicode.com
首页 > 其他好文 > 详细

Mocha

时间:2018-08-09 23:40:10      阅读:218      评论:0      收藏:0      [点我收藏+]

标签:mes   ast   xib   mapping   git   sse   array   host   exce   

Mocha

https://mochajs.org/#installation

Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser, making asynchronous testing simple and fun. Mocha tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases. Hosted on GitHub.

 

Assert API

https://nodejs.org/api/assert.html

 

 

自己动手

https://github.com/fanqingsong/code-snippet/tree/master/web/mocha_test

var assert = require(‘assert‘);
describe(‘Array‘, function() {
  describe(‘#indexOf()‘, function() {
    it(‘should return -1 when the value is not present‘, function() {
      assert.equal([1,2,3].indexOf(4), -1);
    });
  });
});

 

Mocha

标签:mes   ast   xib   mapping   git   sse   array   host   exce   

原文地址:https://www.cnblogs.com/lightsong/p/9452464.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!