afterEach([fn][, options])
fn<Function> | <AsyncFunction> 钩子函数。如果钩子使用回调,则回调函数作为第二个参数传入。默认值: 一个空操作函数。options<Object> 钩子的配置选项。支持以下属性:signal<AbortSignal> 允许中止正在进行的钩子。timeout<number> 钩子将在指定毫秒数后失败。如果未指定,子测试将继承父测试的此值。默认值:Infinity。
此函数会创建一个钩子,在当前测试套件中的每个测试之后运行。即使测试失败,afterEach() 钩子也会执行。
【This function creates a hook that runs after each test in the current suite.
The afterEach() hook is run even if the test fails.】
describe('tests', async () => {
afterEach(() => console.log('finished running a test'));
it('is a subtest', () => {
assert.ok('some relevant assertion here');
});
});