function requireMock(modulePath, importMeta) {
  const dir = path.dirname(url.fileURLToPath(importMeta.url));
  modulePath = path.resolve(dir, modulePath);
  const mock = require(modulePath);
  if (!Object.keys(mock).some(key => mock[key]?.mock)) {
    throw new Error(`${modulePath} was not mocked!`);
  }
  return mock;
}
Same as importMock, but uses require instead to avoid
an unnecessary `.default` or Promise return value.

@param {string} modulePath
@param {ImportMeta} importMeta
@return {Record<string, Mock<any>>}