function toJSONResult(result) {
  try {
    return {...JSON.parse(result.output), ...result};
  } catch (err) {
    throw new Error(
      `Couldn't parse JSON: ${err.message}\n\nOriginal result output: ${result.output}`
    );
  }
}
Coerce output as returned by _spawnMochaWithListeners using JSON reporter into a JSONResult as
recognized by our custom unexpected assertions
@param {RawResult} result - Raw stdout from Mocha run using JSON reporter
@returns {JSONResult}