'test:coverage' 事件


  • data <Object>
    • summary <Object> 包含覆盖率报告的对象。
      • files <Array> 单个文件的一系列覆盖率报告。 每个报告都是具有以下架构的对象:
        • path <string> 文件的绝对路径。
        • totalLineCount <number> 总行数。
        • totalBranchCount <number> 分支总数。
        • totalFunctionCount <number> 函数总数。
        • coveredLineCount <number> 被覆盖的行数。
        • coveredBranchCount <number> 覆盖的分支数。
        • coveredFunctionCount <number> 覆盖函数的个数。
        • coveredLinePercent <number> 覆盖行的百分比。
        • coveredBranchPercent <number> 覆盖的分支百分比。
        • coveredFunctionPercent <number> 覆盖的函数百分比。
        • uncoveredLineNumbers <Array> 一个整数数组,表示未覆盖的行号。
      • totals <Object> 包含所有文件覆盖率摘要的对象。
        • totalLineCount <number> 总行数。
        • totalBranchCount <number> 分支总数。
        • totalFunctionCount <number> 函数总数。
        • coveredLineCount <number> 被覆盖的行数。
        • coveredBranchCount <number> 覆盖的分支数。
        • coveredFunctionCount <number> 覆盖函数的个数。
        • coveredLinePercent <number> 覆盖行的百分比。
        • coveredBranchPercent <number> 覆盖的分支百分比。
        • coveredFunctionPercent <number> 覆盖的函数百分比。
      • workingDirectory <string> 代码覆盖开始时的工作目录。 这对于显示相对路径名很有用,以防测试更改了 Node.js 进程的工作目录。
    • nesting <number> 测试的嵌套级别。

启用代码覆盖率并且所有测试都已完成时发出。

  • data <Object>
    • summary <Object> An object containing the coverage report.
      • files <Array> An array of coverage reports for individual files. Each report is an object with the following schema:
        • path <string> The absolute path of the file.
        • totalLineCount <number> The total number of lines.
        • totalBranchCount <number> The total number of branches.
        • totalFunctionCount <number> The total number of functions.
        • coveredLineCount <number> The number of covered lines.
        • coveredBranchCount <number> The number of covered branches.
        • coveredFunctionCount <number> The number of covered functions.
        • coveredLinePercent <number> The percentage of lines covered.
        • coveredBranchPercent <number> The percentage of branches covered.
        • coveredFunctionPercent <number> The percentage of functions covered.
        • uncoveredLineNumbers <Array> An array of integers representing line numbers that are uncovered.
      • totals <Object> An object containing a summary of coverage for all files.
        • totalLineCount <number> The total number of lines.
        • totalBranchCount <number> The total number of branches.
        • totalFunctionCount <number> The total number of functions.
        • coveredLineCount <number> The number of covered lines.
        • coveredBranchCount <number> The number of covered branches.
        • coveredFunctionCount <number> The number of covered functions.
        • coveredLinePercent <number> The percentage of lines covered.
        • coveredBranchPercent <number> The percentage of branches covered.
        • coveredFunctionPercent <number> The percentage of functions covered.
      • workingDirectory <string> The working directory when code coverage began. This is useful for displaying relative path names in case the tests changed the working directory of the Node.js process.
    • nesting <number> The nesting level of the test.

Emitted when code coverage is enabled and all tests have completed.