function getAssertionResult(auditResults, aggregationMethod, assertionType, expectedValue) {
  const values = auditResults.map(AUDIT_TYPE_VALUE_GETTERS[assertionType]);
  const filteredValues = values.filter(isFiniteNumber);
  const {operator, passedFn} = AUDIT_TYPE_OPERATORS[assertionType];

  if (
    (!filteredValues.length && aggregationMethod !== 'pessimistic') ||
    (filteredValues.length !== values.length && aggregationMethod === 'pessimistic')
  ) {
    /** @type {string|undefined} */
    let message = undefined;
    if (values.some(v => v === undefined)) {
      const userAction = `"${assertionType}" might not be a valid assertion for this audit.`;
      message = `Audit did not produce a value at all. ${userAction}`;
    } else {
      const userAction =
        aggregationMethod === 'pessimistic'
          ? 'Try using an aggregationMethod other than "pessimistic".'
          : 'If this is reproducible, please file an issue on GitHub.';
      message = `Audit failed to produce a valid value. ${userAction}`;
    }

    const didRun = values.map(value => (isFiniteNumber(value) ? value : NaN));

    return [
      {
        name: assertionType,
        expected: expectedValue,
        actual: NaN,
        values: didRun,
        operator,
        passed: false,
        message,
      },
    ];
  }

  const actualValue = getValueForAggregationMethod(
    filteredValues,
    aggregationMethod,
    assertionType
  );

  return [
    {
      name: assertionType,
      expected: expectedValue,
      actual: actualValue,
      values: filteredValues,
      operator,
      passed: passedFn(actualValue, expectedValue),
    },
  ];
}
@param {LH.AuditResult[]} auditResults
@param {LHCI.AssertCommand.AssertionAggregationMethod} aggregationMethod
@param {LHCI.AssertResults.AssertionType} assertionType
@param {number} expectedValue
@return {LHCI.AssertResults.AssertionResultNoURL[]}