多报告器
¥Multiple reporters
可以多次指定 --test-reporter 标志,以多种格式报告测试结果。在这种情况下,需要使用 --test-reporter-destination 为每个报告者指定目标。目标可以是 stdout、stderr 或文件路径。报告器和目标根据指定的顺序配对。
¥The --test-reporter flag can be specified multiple times to report test
results in several formats. In this situation
it is required to specify a destination for each reporter
using --test-reporter-destination.
Destination can be stdout, stderr, or a file path.
Reporters and destinations are paired according
to the order they were specified.
在下面的例子中,spec 报告器将输出到 stdout,dot 报告器将输出到 file.txt:
¥In the following example, the spec reporter will output to stdout,
and the dot reporter will output to file.txt:
node --test-reporter=spec --test-reporter=dot --test-reporter-destination=stdout --test-reporter-destination=file.txt 当指定单个报告者时,目标将默认为 stdout,除非明确提供目标。
¥When a single reporter is specified, the destination will default to stdout,
unless a destination is explicitly provided.