Repository: nodejs/node
File: lib/internal/test_runner/test.js (JavaScript)

Code before:

    if (skip) {
      fn = noop;
    }

    this.abortController = new AbortController();
    this.outerSignal = signal;
    this.signal = this.abortController.signal;

    validateAbortSignal(signal, 'options.signal');
    if (signal) {
      kResistStopPropagation ??= require('internal/event_target').kResistStopPropagation;
    }

    this.outerSignal?.addEventListener(
      'abort',
      this.#abortHandler,
      { __proto__: null, [kResistStopPropagation]: true },
    );

    this.fn = fn;
    this.mock = null;
    this.plan = null;
    this.expectedAssertions = plan;
    this.cancelled = false;
    this.expectFailure = parseExpectFailure(expectFailure);
    this.skipped = skip !== undefined && skip !== false;
    this.isTodo = (todo !== undefined && todo !== false) || this.parent?.isTodo;
    this.startTime = null;
    this.endTime = null;
    this.passed = false;
    this.error = null;
    this.attempt = undefined;
    this.passedAttempt = undefined;
    this.message = typeof skip === 'string' ? skip :
      typeof todo === 'string' ? todo : null;
    this.activeSubtests = 0;
    this.pendingSubtests = [];
    this.readySubtests = new SafeMap();
    this.unfinishedSubtests = new SafeSet();
    this.subtestsPromise = null;
    this.subtests = [];
    this.waitingOn = 0;
    this.finished = false;
    this.hooks = {
      __proto__: null,
      before: [],
      after: [],
      beforeEach: [],
      afterEach: [],
      ownAfterEachCount: 0,

Review comment (bug):
Supporting `suite.expectFailure` ***might*** be as simple as:

```suggestion
    this.expectFailure = parseExpectFailure(expectFailure) || this.parent?.expectFailure;
```


Code after:
    }

    if (skip) {
      fn = noop;
    }

    this.abortController = new AbortController();
    this.outerSignal = signal;
    this.signal = this.abortController.signal;

    validateAbortSignal(signal, 'options.signal');
    if (signal) {
      kResistStopPropagation ??= require('internal/event_target').kResistStopPropagation;
    }

    this.outerSignal?.addEventListener(
      'abort',
      this.#abortHandler,
      { __proto__: null, [kResistStopPropagation]: true },
    );

    this.fn = fn;
    this.mock = null;
    this.plan = null;
    this.expectedAssertions = plan;
    this.cancelled = false;
    this.expectFailure = parseExpectFailure(expectFailure) || this.parent?.expectFailure;
    this.skipped = skip !== undefined && skip !== false;
    this.isTodo = (todo !== undefined && todo !== false) || this.parent?.isTodo;
    this.startTime = null;
    this.endTime = null;
    this.passed = false;
    this.error = null;
    this.attempt = undefined;
    this.passedAttempt = undefined;
    this.message = typeof skip === 'string' ? skip :
      typeof todo === 'string' ? todo : null;
    this.activeSubtests = 0;
    this.pendingSubtests = [];
    this.readySubtests = new SafeMap();
    this.unfinishedSubtests = new SafeSet();
    this.subtestsPromise = null;
    this.subtests = [];
    this.waitingOn = 0;
    this.finished = false;
    this.hooks = {
      __proto__: null,
      before: [],
      after: [],
      beforeEach: [],
      afterEach: [],