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


  • name <string> 测试的名称,在报告测试结果时显示。默认值: fnname 属性,或如果 fn 没有名称,则为 '<anonymous>'
  • options <Object> 套件的配置选项。支持与 test([名称][, options][, fn]) 相同的选项。
  • fn <Function> | <AsyncFunction> 被测试的函数。如果测试使用回调函数,则回调函数作为参数传递。默认值: 一个无操作函数。
  • 返回:undefined

it() 函数是从 node:test 模块中导入的值。每次调用此函数都会在 TAP 输出中创建一个测试点。

【The it() function is the value imported from the node:test module. Each invocation of this function results in the creation of a test point in the TAP output.】