assertModule = (allegedModule, path, url) => {
  const moduleDescriptor = Object(allegedModule);
  assert(
    allegedModule === moduleDescriptor && !Array.isArray(moduleDescriptor),
    `${path} must be an object, got ${allegedModule} in ${q(url)}`,
  );

  const { compartment, module, location, parser, exit, deferredError } =
    moduleDescriptor;
  if (compartment !== undefined || module !== undefined) {
    assertCompartmentModule(moduleDescriptor, path, url);
  } else if (location !== undefined || parser !== undefined) {
    assertFileModule(moduleDescriptor, path, url);
  } else if (exit !== undefined) {
    assertExitModule(moduleDescriptor, path, url);
  } else if (deferredError !== undefined) {
    assert.typeof(
      deferredError,
      'string',
      `${path}.deferredError must be a string contaiing an error message`,
    );
  } else {
    assert.fail(
      `${path} is not a valid module descriptor, got ${q(allegedModule)} in ${q(
        url,
      )}`,
    );
  }
}
@param {unknown} allegedModule
@param {string} path
@param {string} url