{"record":{"id":"5a180972b89e61ca","repo":"jestjs/jest","slug":"sum-computedtotal-of-passed-passedtestsuite","errorCode":null,"errorMessage":"Sum(${computedTotal}) of passed (${passedTestSuites}) and failed (${failedTestSuites}) test suites is greater than the total number of test suites (${totalTestSuites}). Please report the bug at https://github.com/jestjs/jest/issues","messagePattern":"Sum\\((.+?)\\) of passed \\((.+?)\\) and failed \\((.+?)\\) test suites is greater than the total number of test suites \\((.+?)\\)\\. Please report the bug at https://github\\.com/jestjs/jest/issues","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/jest-reporters/src/GitHubActionsReporter.ts","lineNumber":170,"sourceCode":"        .replaceAll('\\n', '%0A'),\n    );\n\n    this.log(\n      `\\n::${type} file=${file},line=${line},title=${title}::${message}`,\n    );\n  }\n\n  private isLastTestSuite(results: AggregatedResult): boolean {\n    const passedTestSuites = results.numPassedTestSuites;\n    const failedTestSuites = results.numFailedTestSuites;\n    const totalTestSuites = results.numTotalTestSuites;\n    const computedTotal = passedTestSuites + failedTestSuites;\n    if (computedTotal < totalTestSuites) {\n      return false;\n    } else if (computedTotal === totalTestSuites) {\n      return true;\n    } else {\n      throw new Error(\n        `Sum(${computedTotal}) of passed (${passedTestSuites}) and failed (${failedTestSuites}) test suites is greater than the total number of test suites (${totalTestSuites}). Please report the bug at https://github.com/jestjs/jest/issues`,\n      );\n    }\n  }\n\n  private printFullResult(context: TestContext, results: TestResult): void {\n    const rootDir = context.config.rootDir;\n    let testDir = results.testFilePath.replace(rootDir, '');\n    testDir = testDir.slice(1);\n    const resultTree = this.getResultTree(\n      results.testResults,\n      testDir,\n      results.perfStats,\n    );\n    this.printResultTree(resultTree, context.config, results.console);\n  }\n\n  private arrayEqual(a1: Array<any>, a2: Array<any>): boolean {","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/jestjs/jest/blob/8e6d128e4a278059ecddecaa97400b04c8ae5fd9/packages/jest-reporters/src/GitHubActionsReporter.ts#L152-L188","documentation":"Internal invariant in GitHubActionsReporter.isLastTestSuite: numPassedTestSuites + numFailedTestSuites must never exceed numTotalTestSuites. If it does, the aggregated results are inconsistent and Jest treats it as a framework bug, asking the user to file an issue.","triggerScenarios":"Reached only when AggregatedResult counts are mutually inconsistent — e.g., a custom reporter or testResults transformer mutated numPassedTestSuites/numFailedTestSuites/numTotalTestSuites independently, or a Jest internal double-counted suites.","commonSituations":"A third-party/custom reporter mutating the AggregatedResult object; a buggy jest-circus/jest-jasmine integration double-reporting; a known regression in a specific Jest version; concurrent workers producing miscounted results.","solutions":["Upgrade Jest to the latest patch/minor of your major and re-run.","Audit any custom reporter or test-runner integration that touches results.numPassedTestSuites/numFailedTestSuites/numTotalTestSuites.","Reproduce with --runInBand to rule out worker race conditions.","If it persists, file the bug at https://github.com/jestjs/jest/issues with the counts and a minimal repro."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// In a custom reporter wrapping GitHubActionsReporter\ntry {\n  // let the reporter run\n} catch (err) {\n  if (err instanceof Error && /Sum\\(.*\\) of passed/.test(err.message)) {\n    // known inconsistent AggregatedResult — log and continue rather than crash CI\n    console.error('Inconsistent test suite counts:', err.message);\n  } else {\n    throw err;\n  }\n}","preventionTips":["Do not mutate AggregatedResult.numPassedTestSuites/numFailedTestSuites/numTotalTestSuites in custom reporters.","Keep Jest updated to pick up count-consistency fixes.","Reproduce count bugs with --runInBand to rule out worker races before reporting."],"tags":["reporter","internal","invariant","bug","github-actions"],"backgroundTag":null,"analyzedSha":"8e6d128e4a278059ecddecaa97400b04c8ae5fd9","analyzedAt":"2026-08-10T18:11:27.960Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}