async function assertMatchSnapshot(actual, negate, index) {
    const snapshot = escapeTildes(actual);
    let updateSnapshots = false;
    let currentSnapshot;
    let name;
    if (!isNode) {
      // WTR ENV
      const { getSnapshot, getSnapshotConfig } = await import('@web/test-runner-commands');
      name = getTestPath(window.__WTR_MOCHA_RUNNER__.test, index);
      if (!name) {
        return;
      }
      currentSnapshot = await getSnapshot({ name });
      updateSnapshots = (await getSnapshotConfig()).updateSnapshots;
    } else {
      // Node ENV
      name = getTestPath(currentTest, index);
      const snapshotString = await snapshotStore.get(currentTest.file);
      const blob = new Blob([snapshotString], { type: 'text/javascript' });
      const url = await blobToDataUrl(blob);
      currentSnapshot = (await import(url)).snapshots[name];
      // TODO: get --update-snapshots flag
      // updateSnapshots = (await getSnapshotConfig()).updateSnapshots;
    }
    currentSnapshot = escapeTildes(currentSnapshot);

    if (currentSnapshot && !updateSnapshots) {
      if (negate ? currentSnapshot === snapshot : currentSnapshot !== snapshot) {
        throw new chai.AssertionError(
          `Snapshot "${name}" ${negate ? 'matches' : 'does not match'} the saved snapshot on disk`,
          {
            actual: snapshot,
            expected: currentSnapshot,
            showDiff: !negate,
          },
          chai.util.flag(this, 'ssfi'),
        );
      }
    } else if (currentSnapshot !== snapshot) {
      if (!isNode) {
        const { saveSnapshot: saveSnapshotWTR } = await import('@web/test-runner-commands');
        await saveSnapshotWTR({ name, content: snapshot });
      } else {
        const { isSaveSnapshotPayload } = await import('@web/test-runner-commands/plugins');
        const payload = { name, content: snapshot };
        if (!isSaveSnapshotPayload(payload)) {
          throw new Error('Invalid save snapshot payload');
        }
        await snapshotStore.saveSnapshot('session_id_dummy', currentTest.file, name, snapshot);
      }
    }
  }
Base HTML snapshot assertion for `assert` interface.
@this {Chai.AssertionStatic}
@param {string|Node} actual
@param {boolean} negate