zoukankan      html  css  js  c++  java
  • hapi lab测试框架简单使用

    1. 依赖安装
    yarn init 
    yarn add lab code
    2. 基本模式
    const Lab = require('lab');
    const Code = require('code');
    const lab = exports.lab = Lab.script();
    const expect = Code.expect;
    const describe = lab.describe;
    const it = lab.test;
    const before = lab.before;
    const after = lab.after;
    
    describe("app plus test suite",function(){
        it('returns true when 1 + 1 equals 2', () => {
            expect(1 + 1).to.equal(2);
        });
        it('returns true when 2 + 1 equals 2', () => {
            expect(1 + 2).to.equal(4);
        });
    })
     
    3. 总结
    总的来说使用还是比较简单的,同时类似jasmin测试框架(web),testem 同时facebook的jest 测试框架也是一个不错的选择,后面应该会有jest的相关介绍
    4. 参考资料
    https://www.npmjs.com/package/lab
  • 相关阅读:
    uva 550
    uva 10110
    uva 10014
    uva 10177
    uva 846
    Dear Project Manager, I Hate You
    创业型软件公司的心得
    架构设计的心得
    程序员常去的103个网站
    66个经典源码网站
  • 原文地址:https://www.cnblogs.com/rongfengliang/p/8179462.html
Copyright © 2011-2022 走看看