Here’s a tip for testing asynchronous JavaScript functions that should throw exceptions with Jest.

The solution is to use rejects, for example:

const boom = async () => { throw new Error('Boom!') }

await expect(boom).rejects.toThrow('Boom!');