• This function creates a hook that runs before each test in the current suite.

    describe('tests', async () => {
    beforeEach(() => console.log('about to run a test'));
    it('is a subtest', () => {
    assert.ok('some relevant assertion here');
    });
    });

    Parameters

    • Optionalfn: HookFn

      The hook function. If the hook uses callbacks, the callback function is passed as the second argument.

    • Optionaloptions: HookOptions

      Configuration options for the hook.

    Returns void

    v18.8.0, v16.18.0