searchDescriptor = async (
  location,
  maybeReadDescriptor,
  { log: _log = noop } = {},
) => {
  await null;
  let directory = resolveLocation('./', location);
  for (;;) {
    const packageDescriptorLocation = resolveLocation(
      'package.json',
      directory,
    );
    // eslint-disable-next-line no-await-in-loop
    const data = await maybeReadDescriptor(packageDescriptorLocation);
    if (data !== undefined) {
      return {
        data,
        directory,
        location,
        packageDescriptorLocation,
      };
    }
    const parentDirectory = resolveLocation('../', directory);
    if (parentDirectory === directory) {
      throw Error(`Cannot find package.json along path to ${q(location)}`);
    }
    directory = parentDirectory;
  }
}
Searches for the first ancestor directory of given location that contains a
package.json.
Probes by calling maybeReadDescriptor.
Returns the result of maybeReadDescriptor as data whenever a value is returned.

@template T
@param {string} location
@param {MaybeReadDescriptorFn<T>} maybeReadDescriptor
@param {SearchDescriptorOptions} options
@returns {Promise<SearchDescriptorResult<T>>}