jestjs/jest · error · ErrorWithStack

Jest: `failing` tests are only supported in `jest-circus`.

Error message

Jest: `failing` tests are only supported in `jest-circus`.

What it means

The `failing` marker on a test (e.g. `it.failing(...)`) is a jest-circus-only feature that inverts pass/fail. Under the jasmine2 test runner, jest-jasmine2 stubs `it.failing` / `fit.failing` / `xit.failing` with a function that always throws an ErrorWithStack pointing to the call site. This prevents silent misbehavior where a 'failing' test appears to pass.

Solutions

  1. Switch the test runner to jest-circus (the Jest default since v27): remove `testRunner: 'jest-jasmine2'` from config.
  2. If you must stay on jasmine2, replace `it.failing(...)` with `it(...)` and use `expect().toBe()` assertions that you expect to fail, or remove the test.
  3. Update to a Jest version where circus is the only bundled runner (Jest 28+).

Example fix

// before (jasmine2 runner)
it.failing('should fail', () => { expect(1).toBe(2); });
// after — switch to circus in jest.config.js
module.exports = { testRunner: 'jest-circus' }; // or omit; it's the default
Defensive patterns

Strategy: validation

Validate before calling

// Detect failing-test usage and warn if running under jasmine2.
const isCircus = require('jest-circus') != null; // or check config.testRunner
if (!isCircus) {
  // scan test files for '.failing' usage
  console.warn('it.failing is not supported under jasmine2 — switch to jest-circus.');
}

Type guard

function isJasmineRunner(config: { testRunner?: string }): boolean {
  return (config.testRunner ?? '').includes('jasmine2');
}

Prevention

When it happens

Trigger: Calling `it.failing('...', () => {...})` (or `test.failing`) in a test file while the project uses `testRunner: 'jest-jasmine2'`. The stub at index.ts:208-213 is assigned to `environment.global.it.failing` at line 222 and throws on invocation.

Common situations: Copying a test that uses `it.failing` from a circus-based project into a jasmine2 project; an old Jest config still pinned to jasmine2; a dependency's test suite uses `failing` but the consuming project runs jasmine2.

Related errors


AI-assisted analysis of jestjs/jest@8e6d128e4a (2026-08-10). Data as JSON: /api/errors/fee034d8943780e1. Report an issue: GitHub.

Appendix: source

Thrown at packages/jest-jasmine2/src/index.ts:209

        // @ts-expect-error: `it` is `void` for some reason
        it.result.__callsite = stack;

        return it;
      };
      return wrapped as any as T;
    }

    environment.global.it = wrapIt(environment.global.it);
    environment.global.xit = wrapIt(environment.global.xit);
    environment.global.fit = wrapIt(environment.global.fit);
  }

  jasmineAsyncInstall(globalConfig, environment.global);

  installEach(environment);

  const failing = () => {
    throw new ErrorWithStack(
      'Jest: `failing` tests are only supported in `jest-circus`.',
      failing,
    );
  };

  failing.each = () => {
    throw new ErrorWithStack(
      'Jest: `failing` tests are only supported in `jest-circus`.',
      failing.each,
    );
  };

  environment.global.it.failing = failing;
  environment.global.fit.failing = failing;
  environment.global.xit.failing = failing;

  environment.global.test = environment.global.it;
  environment.global.it.only = environment.global.fit;

View on GitHub (pinned to 8e6d128e4a)