mochajs/mocha · error · FatalError

ERR_MOCHA_FATAL

ERR_MOCHA_FATAL

Error message

Test failed after root suite execution completed!

What it means

Error "Test failed after root suite execution completed!" thrown in mochajs/mocha.

Source

Thrown at lib/runner.cjs:542

 * - Failed `after each` hook skips remaining tests in a
 *   suite and subsuites, but executes other `after each`
 *   hooks
 *
 * @private
 * @param {Runnable} test
 * @param {Error} err
 * @param {boolean} [force=false] - Whether to fail a pending test.
 */
Runner.prototype.fail = function (test, err, force) {
  force = force === true;
  if (test.isPending() && !force) {
    return;
  }
  if (this.state === constants.STATE_STOPPED) {
    if (err.code === errorConstants.MULTIPLE_DONE) {
      throw err;
    }
    throw createFatalError(
      "Test failed after root suite execution completed!",
      err,
    );
  }

  ++this.failures;
  debug("total number of failures: %d", this.failures);
  test.state = STATE_FAILED;

  if (!isError(err)) {
    err = thrown2Error(err);
  }

  // Filter the stack traces
  if (!this.fullStackTrace) {
    const alreadyFiltered = new Set();
    let currentErr = err;

View on GitHub (pinned to 6bcbee4fd9)

When it happens

Trigger: Thrown at lib/runner.cjs:542 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of mochajs/mocha@6bcbee4fd9 (2026-09-01). Data as JSON: /api/errors/aaf57d1f13cab24e. Report an issue: GitHub.