事件:'test:summary'


【Event: 'test:summary'

  • data <Object>
    • counts <Object> 一个包含各种测试结果计数的对象。
      • cancelled <number> 取消测试的总数。
      • failed <number> 测试失败的总次数。
      • passed <number> 通过测试的总数。
      • skipped <number> 跳过测试的总数。
      • suites <number> 运行的套件总数。
      • tests <number> 运行的测试总数,不包括测试套件。
      • todo <number> TODO 测试的总数。
      • topLevel <number> 顶层测试和测试套件的总数。
    • duration_ms <number> 测试运行的持续时间(毫秒)。
    • file <string> | <undefined> 生成摘要的测试文件路径。如果摘要对应多个文件,则此值为 undefined
    • success <boolean> 表示测试运行是否被视为成功。如果发生任何错误情况,例如测试失败或未达到覆盖率阈值,该值将被设置为 false

在测试运行完成时触发。当测试运行完成时,该事件包含相关的指标,对于判断测试运行是通过还是失败非常有用。如果使用进程级测试隔离,则每个测试文件都会生成一个 'test:summary' 事件,此外还会生成最终的累计汇总。

【Emitted when a test run completes. This event contains metrics pertaining to the completed test run, and is useful for determining if a test run passed or failed. If process-level test isolation is used, a 'test:summary' event is generated for each test file in addition to a final cumulative summary.】