async function expectThrowsAsync(method, errorMessage) {
  let error = null;
  try {
    await method();
  } catch (err) {
    error = err;
  }
  expect(error).to.be.an('Error', 'No error was thrown');
  if (errorMessage) {
    expect(/** @type {Error} */ (error).message).to.equal(errorMessage);
  }
}
@param {function} method
@param {string} errorMessage