多报告器


🌐 Multiple reporters

--test-reporter 标志可以多次指定,以便以多种格式报告测试结果。在这种情况下,需要使用 --test-reporter-destination 为每个报告器指定一个目标。目标可以是 stdoutstderr 或文件路径。报告器和目标将按照它们被指定的顺序进行配对。

🌐 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.