function assertHtmlEqualsSnapshotKarma(actual, negate, ...rest) {
    const context = window.__mocha_context__;
    const snapshotState = window.__snapshot__;

    const { message, options } = disambiguateArgs(...rest);
    const { index } = context;
    context.index += 1;
    const path = getMochaTestPath(context.runnable);
    const html = getDiffableHTML(actual, options);

    if (snapshotState.update) {
      snapshotState.set(path, index, html, 'html');
    } else {
      const snapshot = snapshotState.get(path, index);

      if (!snapshot) {
        snapshotState.set(path, index, html, 'html');
      } else {
        const isMatch = snapshotState.match(html, getDiffableHTML(snapshot.code, options));
        if ((isMatch && negate) || (!isMatch && !negate)) {
          /* istanbul ignore next */
          throw new chai.AssertionError(
            message || `Received value does not match stored snapshot ${index}`,
            {
              actual: html,
              expected: snapshot.code,
              showDiff: true,
            },
            chai.util.flag(this, 'ssfi'),
          );
        }
      }
    }
  }
Base HTML snapshot assertion for `assert` interface.
@this {Chai.AssertionStatic}
@param {string|Node} actual
@param {boolean} negate
@param {[string]|[DiffOptions]|[string, DiffOptions]} rest