makeVirtualExecutionContext = originalT => {
  if (optMakeCausalConsoleFromLoggerForSesAva === undefined) {
    // Must tolerate absence as a failure of the feature test. In this
    // case, we fallback to `originalT` itself.
    return originalT;
  }
  const causalConsole = optMakeCausalConsoleFromLoggerForSesAva(originalT.log);
  const virtualT = {
    log: /** @type {import('ava').LogFn} */ (causalConsole.error),
    console: causalConsole,
  };
  // Mirror properties from originalT and its prototype onto virtualT
  // except for those already defined above.
  const originalProto = getPrototypeOf(originalT);
  const descs = {
    // Spread from originalProto before originalT
    // so we wrap properties of the latter in case of collision.
    ...getOwnPropertyDescriptors(originalProto),
    ...getOwnPropertyDescriptors(originalT),
  };
  for (const [name, desc] of entries(descs)) {
    if (!(name in virtualT)) {
      if ('get' in desc) {
        defineProperty(virtualT, name, {
          ...desc,
          get() {
            return originalT[name];
          },
          set(newVal) {
            originalT[name] = newVal;
          },
        });
      } else if (typeof desc.value === 'function') {
        defineProperty(virtualT, name, {
          ...desc,
          value(...args) {
            return originalT[name](...args);
          },
        });
      } else {
        defineProperty(virtualT, name, desc);
      }
    }
  }

  // `harden` should be functional by the time a test callback is invoked.
  // @ts-ignore has extra properties outside type
  return harden(virtualT);
}
@param {import('ava').ExecutionContext} originalT
@returns {import('ava').ExecutionContext}