事件:'test:interrupted'


🌐 Event: 'test:interrupted'

  • data <Object>
    • tests <Array> 包含有关中断测试信息的对象数组。
      • column <number> | <undefined> 定义测试的列号,或者如果测试是通过 REPL 运行的,则为 undefined
      • file <string> | <undefined> 测试文件的路径,如果通过 REPL 运行测试,则为 undefined
      • line <number> | <undefined> 定义测试的行号,或者如果通过 REPL 运行测试,则为 undefined
      • name <string> 测试名称。
      • nesting <number> 测试的嵌套级别。

当测试运行器被 SIGINT 信号中断时(例如,当按下 Ctrl+C)会触发此事件。该事件包含有关中断时正在运行的测试的信息。

在使用进程隔离(默认设置)时,测试名称将是文件路径,因为父运行器只知道文件级别的测试。使用 --test-isolation=none 时,会显示实际的测试名称。

🌐 When using process isolation (the default), the test name will be the file path since the parent runner only knows about file-level tests. When using --test-isolation=none, the actual test name is shown.