lab 常用配置参数 代码片段

版权声明:转载请评论留言 https://blog.csdn.net/solocao/article/details/85850028

1、--leaks 启用内存泄漏检测,并在检测到时向您发出警告

2、代码片段

experiment('getting started with hapi testing,', () => {
  // 这种写法会跳过测试
  test('lab considers this test as TOOD and skips it')
  // 这种写法不会跳过测试
  test('always succeeding :)', () => { })
})

3、testexperiment常用参数

timeout: 设置特定的超时(以毫秒为单位)。 默认为2,000 ms或-m的值
parallel: 在每个实验级别内激活并行执行测试。 默认为false(串行执行)
skip: 跳过执行。 设置父级跳过后,无法在子级中覆盖
only: 使用skip标记所有其他测试或实验

为每个测试并行运行的实验提供一个选项对象:

experiment('getting started with hapi testing,', { parallel: true }, () => {  
  test('lab considers this test as TODO and skips it')

  test('always succeeding :)', { timeout: 5000 }, () => {})
})

设置only和skip选项的另一种方法是链接具有相同名称的方法,如下所示:

experiment('getting started with hapi testing,', { parallel: true }, () => {  
  test.skip('lab considers this test as TODO and skips it')
  test('always succeeding :)', { timeout: 5000 }, () => {})
})

猜你喜欢

转载自blog.csdn.net/solocao/article/details/85850028
今日推荐