context.after([fn][, options])
fn<Function> | <AsyncFunction> 钩子函数。该函数的第一个参数是一个TestContext对象。如果钩子使用回调函数,则回调函数作为第二个参数传入。默认值: 一个空操作函数。options<Object> 钩子的配置选项。支持以下属性:signal<AbortSignal> 允许中止正在进行的钩子。timeout<number> 钩子将在指定毫秒数后失败。如果未指定,子测试将继承父测试的此值。默认值:Infinity。
此函数用于创建一个在当前测试结束后运行的钩子。
【This function is used to create a hook that runs after the current test finishes.】
test('top level test', async (t) => {
t.after((t) => t.diagnostic(`finished running ${t.name}`));
assert.ok('some relevant assertion here');
});