Test reporters


node:test 模块支持传递 --test-reporter 标志,以便测试运行器使用特定的报告程序。

支持以下内置报告器:

  • tap tap 报告器是测试运行程序使用的默认报告器。 它以 TAP 格式输出测试结果。

  • spec spec 报告器以人类可读的格式输出测试结果。

  • dot dot 报告器以紧凑的格式输出测试结果,其中每个通过的测试用一个 . 表示,每个失败的测试用一个 X 表示。

The node:test module supports passing --test-reporter flags for the test runner to use a specific reporter.

The following built-reporters are supported:

  • tap The tap reporter is the default reporter used by the test runner. It outputs the test results in the TAP format.

  • spec The spec reporter outputs the test results in a human-readable format.

  • dot The dot reporter outputs the test results in a compact format, where each passing test is represented by a ., and each failing test is represented by a X.