活动:'test:log'


🌐 Event: 'test:log'

  • data <Object>
    • column <number> | <undefined> 定义测试的列号,如果测试是通过 REPL 运行的,则为 undefined
    • data <any> 传递给 context.log 的结构化负载,如果没有提供,则传递给 undefined。测试运行器不会解释这个值。
    • entryFile <string> | <undefined> 作为触发此事件的子进程入口点而执行的测试文件路径。只有在使用进程隔离运行测试时才会出现。当测试是在入口文件导入的模块中定义时,可能与 file 不同。
    • file <string> | <undefined> 测试文件的路径,如果测试是通过 REPL 运行的,则为 undefined
    • line <number> | <undefined> 定义测试的行号,如果测试是通过 REPL 运行的,则为 undefined
    • message <string> 日志消息。
    • name <string> 测试名称。
    • nesting <number> 测试的嵌套级别。
    • parentId <number> | <undefined> 封闭测试的 testId,或顶层测试的 undefined
    • testId <number> 发出日志消息的测试实例的数字标识符。

当调用 context.log 时触发。不同于 'test:diagnostic',这个事件会立即触发,按测试执行的顺序,所以适合用于实时输出测试结果的报告器。

🌐 Emitted when context.log is called. Unlike 'test:diagnostic', this event is emitted immediately, in the order that the tests execute, making it suitable for reporters that render test output unbuffered.