首页 > 其他 > 详细

Mocha

时间:2018-08-09 23:35:30      阅读:170      评论:0      收藏:0      [点我收藏+]

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!