事件:'test:coverage'


¥Event: 'test:coverage'

  • data <Object>

    • summary <Object> 包含覆盖率报告的对象。

      ¥summary <Object> An object containing the coverage report.

      • files <Array> 单个文件的一系列覆盖率报告。每个报告都是具有以下架构的对象:

        ¥files <Array> An array of coverage reports for individual files. Each report is an object with the following schema:

        • path <string> 文件的绝对路径。

          ¥path <string> The absolute path of the file.

        • totalLineCount <number> 总行数。

          ¥totalLineCount <number> The total number of lines.

        • totalBranchCount <number> 分支总数。

          ¥totalBranchCount <number> The total number of branches.

        • totalFunctionCount <number> 函数总数。

          ¥totalFunctionCount <number> The total number of functions.

        • coveredLineCount <number> 被覆盖的行数。

          ¥coveredLineCount <number> The number of covered lines.

        • coveredBranchCount <number> 覆盖的分支数。

          ¥coveredBranchCount <number> The number of covered branches.

        • coveredFunctionCount <number> 覆盖函数的个数。

          ¥coveredFunctionCount <number> The number of covered functions.

        • coveredLinePercent <number> 覆盖行的百分比。

          ¥coveredLinePercent <number> The percentage of lines covered.

        • coveredBranchPercent <number> 覆盖的分支百分比。

          ¥coveredBranchPercent <number> The percentage of branches covered.

        • coveredFunctionPercent <number> 覆盖的函数百分比。

          ¥coveredFunctionPercent <number> The percentage of functions covered.

        • functions <Array> 表示函数覆盖率的函数数组。

          ¥functions <Array> An array of functions representing function coverage.

          • name <string> 函数的名称。

            ¥name <string> The name of the function.

          • line <number> 定义函数的行号。

            ¥line <number> The line number where the function is defined.

          • count <number> 调用该函数的次数。

            ¥count <number> The number of times the function was called.

        • branches <Array> 代表分支覆盖范围的分支数组。

          ¥branches <Array> An array of branches representing branch coverage.

          • line <number> 定义分支的行号。

            ¥line <number> The line number where the branch is defined.

          • count <number> 分支被占用的次数。

            ¥count <number> The number of times the branch was taken.

        • lines <Array> 表示行号及其被覆盖次数的行数组。

          ¥lines <Array> An array of lines representing line numbers and the number of times they were covered.

          • line <number> 行号。

            ¥line <number> The line number.

          • count <number> 线路被覆盖的次数。

            ¥count <number> The number of times the line was covered.

      • thresholds <Object> 包含每种覆盖类型是否覆盖的对象。

        ¥thresholds <Object> An object containing whether or not the coverage for each coverage type.

        • function <number> 函数覆盖率阈值。

          ¥function <number> The function coverage threshold.

        • branch <number> 分支覆盖率阈值。

          ¥branch <number> The branch coverage threshold.

        • line <number> 行覆盖率阈值。

          ¥line <number> The line coverage threshold.

      • totals <Object> 包含所有文件覆盖率摘要的对象。

        ¥totals <Object> An object containing a summary of coverage for all files.

        • totalLineCount <number> 总行数。

          ¥totalLineCount <number> The total number of lines.

        • totalBranchCount <number> 分支总数。

          ¥totalBranchCount <number> The total number of branches.

        • totalFunctionCount <number> 函数总数。

          ¥totalFunctionCount <number> The total number of functions.

        • coveredLineCount <number> 被覆盖的行数。

          ¥coveredLineCount <number> The number of covered lines.

        • coveredBranchCount <number> 覆盖的分支数。

          ¥coveredBranchCount <number> The number of covered branches.

        • coveredFunctionCount <number> 覆盖函数的个数。

          ¥coveredFunctionCount <number> The number of covered functions.

        • coveredLinePercent <number> 覆盖行的百分比。

          ¥coveredLinePercent <number> The percentage of lines covered.

        • coveredBranchPercent <number> 覆盖的分支百分比。

          ¥coveredBranchPercent <number> The percentage of branches covered.

        • coveredFunctionPercent <number> 覆盖的函数百分比。

          ¥coveredFunctionPercent <number> The percentage of functions covered.

      • workingDirectory <string> 代码覆盖开始时的工作目录。这对于显示相对路径名很有用,以防测试更改了 Node.js 进程的工作目录。

        ¥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> 测试的嵌套级别。

      ¥nesting <number> The nesting level of the test.

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

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