{"id":"fee034d8943780e1","repo":"jestjs/jest","slug":"jest-failing-tests-are-only-supported-in-jest","errorCode":null,"errorMessage":"Jest: `failing` tests are only supported in `jest-circus`.","messagePattern":"Jest: `failing` tests are only supported in `jest-circus`\\.","errorType":"exception","errorClass":"ErrorWithStack","httpStatus":null,"severity":"error","filePath":"packages/jest-jasmine2/src/index.ts","lineNumber":162,"sourceCode":"        // @ts-expect-error: `it` is `void` for some reason\n        it.result.__callsite = stack;\n\n        return it;\n      };\n      return wrapped as any as T;\n    }\n\n    environment.global.it = wrapIt(environment.global.it);\n    environment.global.xit = wrapIt(environment.global.xit);\n    environment.global.fit = wrapIt(environment.global.fit);\n  }\n\n  jasmineAsyncInstall(globalConfig, environment.global);\n\n  installEach(environment);\n\n  const failing = () => {\n    throw new ErrorWithStack(\n      'Jest: `failing` tests are only supported in `jest-circus`.',\n      failing,\n    );\n  };\n\n  failing.each = () => {\n    throw new ErrorWithStack(\n      'Jest: `failing` tests are only supported in `jest-circus`.',\n      failing.each,\n    );\n  };\n\n  environment.global.it.failing = failing;\n  environment.global.fit.failing = failing;\n  environment.global.xit.failing = failing;\n\n  environment.global.test = environment.global.it;\n  environment.global.it.only = environment.global.fit;","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/jestjs/jest/blob/f49721c78e195558b40913977c9230f5b7f559d8/packages/jest-jasmine2/src/index.ts#L144-L180","documentation":"The `it.failing` / `test.failing` API (a test expected to fail) is implemented only in jest-circus, the default modern runner. When jest-jasmine2 is the test runner, index.ts replaces `it.failing` with a function that throws ErrorWithStack on call, so a test author discovers immediately that failing is unsupported rather than the directive being silently ignored. Errors 108 and 109 are the same guard for the base and the `.each` variant.","triggerScenarios":"Using `jest-jasmine2` as the testRunner (legacy runner) and writing `it.failing('...', () => {...})`. index.ts:161-166 defines `failing` to throw, and line 175 assigns it to it.failing/fit.failing/xit.failing. Calling it.failing(...) triggers the throw at line 162.","commonSituations":"Migrating a codebase that adopted `it.failing`; an older Jest config pinned to jasmine2 via `testRunner: 'jest-jasmine2'`; sharing test files between projects with different runners; copy-pasting a circus-only test into a jasmine2 project.","solutions":["Switch to the default runner jest-circus: remove the `testRunner: 'jest-jasmine2'` override (circus has been default since Jest 27).","If you must stay on jasmine2, remove the `.failing` modifier and track the expected failure another way (it.skip plus a TODO).","Verify your Jest version supports circus and that no config/tooling is re-pinning jasmine2."],"exampleFix":"// before — jasmine2 runner + failing\ntestRunner: 'jest-jasmine2'\nit.failing('not yet implemented', () => { expect(x).toBe(2); });\n\n// after — default circus runner (remove the override)\n// jest.config.js: delete the testRunner line\nit.failing('not yet implemented', () => { expect(x).toBe(2); });","handlingStrategy":"validation","validationCode":"// Detect failing-usage when jasmine2 is the runner\nconst usingJasmine2 = config.testRunner?.endsWith('jest-jasmine2');\nif (usingJasmine2 && sourceUsesFailing(testSource)) {\n  throw new Error('it.failing requires jest-circus; remove testRunner override or drop .failing.');\n}\n// (sourceUsesFailing would grep the test file for /it\\.failing|test\\.failing/)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer the default runner (jest-circus) — avoid pinning testRunner to jest-jasmine2 unless required.","Add a CI lint that flags it.failing usage when jasmine2 is configured.","Document runner-specific APIs for teams sharing test files."],"tags":["jasmine2","test-runner","failing","circus","config"],"analyzedSha":"f49721c78e195558b40913977c9230f5b7f559d8","analyzedAt":"2026-08-03T20:16:28.571Z","schemaVersion":2}