首页 > 解决方案 > hapi/lab (and jest): 有没有办法在单独的 js 文件中有一个描述块?

问题描述

我正在使用 nodejs 中的 hapi/lab 编写测试脚本。我想要一个使用 hapi.server 注入 http 选项(模拟集成测试)的描述块。就像是:

main.test.js: ...

describe('main', async () => {
   before(async () => {...}

   describe('inner-main', async() => {
      **externalDescribe**(some params that exists in this file)

      it('test specific to this file', async () => {...})
   })
})

外部文件.test.js: ...

function **externalDescribe**(some params) {
  describe('external', async () => {
      it('first it', async () => {
        ...
      })
  })
}

或类似的东西。

标签: javascriptnode.jstestingintegration-testinghapi

解决方案


推荐阅读