jestjs/jest · error · Error
Sum(${computedTotal}) of passed (${passedTestSuites}) and fa
Error message
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 What it means
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.
Source
Thrown at packages/jest-reporters/src/GitHubActionsReporter.ts:170
.replaceAll('\n', '%0A'),
);
this.log(
`\n::${type} file=${file},line=${line},title=${title}::${message}`,
);
}
private isLastTestSuite(results: AggregatedResult): boolean {
const passedTestSuites = results.numPassedTestSuites;
const failedTestSuites = results.numFailedTestSuites;
const totalTestSuites = results.numTotalTestSuites;
const computedTotal = passedTestSuites + failedTestSuites;
if (computedTotal < totalTestSuites) {
return false;
} else if (computedTotal === totalTestSuites) {
return true;
} else {
throw new Error(
`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`,
);
}
}
private printFullResult(context: TestContext, results: TestResult): void {
const rootDir = context.config.rootDir;
let testDir = results.testFilePath.replace(rootDir, '');
testDir = testDir.slice(1);
const resultTree = this.getResultTree(
results.testResults,
testDir,
results.perfStats,
);
this.printResultTree(resultTree, context.config, results.console);
}
private arrayEqual(a1: Array<any>, a2: Array<any>): boolean {View on GitHub (pinned to 8e6d128e4a)
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.
Defensive patterns
Strategy: try-catch
Try / catch
// In a custom reporter wrapping GitHubActionsReporter
try {
// let the reporter run
} catch (err) {
if (err instanceof Error && /Sum\(.*\) of passed/.test(err.message)) {
// known inconsistent AggregatedResult — log and continue rather than crash CI
console.error('Inconsistent test suite counts:', err.message);
} else {
throw err;
}
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Could not resolve a module for a custom reporter. Module n
- notify reporter requires optional peer dependency "node-noti
- The option summaryThreshold should be a number
- Attempted to display seed but seed value is undefined
AI-assisted analysis of jestjs/jest@8e6d128e4a (2026-08-10).
Data as JSON: /api/errors/5a180972b89e61ca.
Report an issue: GitHub.