describe([name][, options][, fn])


  • name <string> 测试套件的名称,在报告测试结果时显示。默认值: 如果 fn 有名称,则为 fnname 属性;如果 fn 没有名称,则为 '<anonymous>'
  • options <Object> 套件的配置选项。支持与 test([名称][, options][, fn]) 相同的选项。
  • fn <Function> | <AsyncFunction> 套件下的函数,用于声明所有子测试和子套件。该函数的第一个参数是一个 SuiteContext 对象。默认值: 一个空操作函数。
  • 返回:undefined

node:test 模块导入的 describe() 函数。每次调用此函数都会创建一个子测试以及 TAP 输出中的一个测试点。在调用顶层 describe 函数后,所有顶层测试和测试套件将会执行。

【The describe() function imported from the node:test module. Each invocation of this function results in the creation of a Subtest and a test point in the TAP output. After invocation of top level describe functions, all top level tests and suites will execute.】