Problem
npm run test on main still fails after PR #3341 (the moduleNameMapper regex fix for #3340). That PR reduced failures from 51 to 29 failed suites, but 29 remain:
agents/metadata-agent/__tests__/api/octokit-client.test.js
agents/metadata-agent/__tests__/api/retry-strategy.test.js
agents/pr-creation-agent/__tests__/integration/label-application-scenarios.test.js
agents/pr-creation-agent/__tests__/orchestrate-pr-creation.test.js
agents/pr-creation-agent/__tests__/route-pr-template.test.js
agents/pr-creation-agent/__tests__/validate-branch-name.test.js
scripts/agents/__tests__/issues.agent.test.js
scripts/agents/__tests__/linting-agent/integration/block-plugin.integration.test.js
scripts/agents/__tests__/linting-agent/integration/control-plane.integration.test.js
scripts/agents/__tests__/linting-agent/integration/wordpress-plugin.integration.test.js
scripts/agents/__tests__/linting-agent/integration/wordpress-theme.integration.test.js
scripts/agents/__tests__/module-system-consistency.test.js
scripts/agents/__tests__/planner.agent.test.js
scripts/agents/__tests__/release.agent.mcp.test.js
scripts/agents/includes/__tests__/changelogUtils.test.js
scripts/agents/includes/__tests__/check-template-labels.test.js
scripts/agents/includes/__tests__/header-footer.test.js
scripts/agents/includes/__tests__/label-heuristics.test.js
scripts/agents/includes/__tests__/label-sync.test.js
scripts/automation/__tests__/integration-workflow-staging.test.js
scripts/automation/issue-agent/shared/__tests__/github-client.test.js
scripts/metrics/__tests__/integration.test.js
scripts/metrics/__tests__/metrics-reporter.test.js
scripts/metrics/__tests__/metrics-storage.test.js
scripts/metrics/__tests__/performance.test.js
scripts/metrics/integrations/__tests__/issue-templates.test.js
scripts/validation/__tests__/openspec-labels.test.js
scripts/validation/__tests__/project-meta-sync.test.js
scripts/workflows/branch-policy/__tests__/validate-main-branch-pr.test.js
213 individual tests fail across these 29 suites (of 3725 total). This is a Test Suites: 29 failed, 177 passed, 206 total / Tests: 213 failed, 10 todo, 3502 passed, 3725 total result.
Impact
The check CI job (npm run test) fails on every recent PR regardless of content — confirmed also failing on the just-merged PR #3337. It does not appear to actually gate merging (Mergify shows Merge Protections: skipping on affected PRs), but it means the "check" status is permanently red and not a meaningful signal.
One confirmed root cause among these
scripts/agents/issues.agent.cjs:13 — const __filename = __filename || process.argv[1]; throws SyntaxError: Identifier '__filename' has already been declared under Jest's CommonJS transform, since __filename is already a module-scope binding there. This breaks scripts/agents/__tests__/issues.agent.test.js (and likely planner.agent.test.js, which follows the same ../X.agent.cjs require pattern per its own failure in the same run — worth checking planner.agent.cjs for the identical const __filename = __filename || ... idiom).
Suggested approach
- Triage the 29 suites into root-cause clusters (the
__filename redeclaration pattern likely explains several of the *.agent.test.js failures at once).
- Fix cluster by cluster rather than file by file.
- Once
npm run test is clean, consider whether check should become an actual required/blocking status check — right now a permanently-red required-looking check that doesn't block merges is worse than no check.
Related
Problem
npm run testonmainstill fails after PR #3341 (the moduleNameMapper regex fix for #3340). That PR reduced failures from 51 to 29 failed suites, but 29 remain:213 individual tests fail across these 29 suites (of 3725 total). This is a
Test Suites: 29 failed, 177 passed, 206 total/Tests: 213 failed, 10 todo, 3502 passed, 3725 totalresult.Impact
The
checkCI job (npm run test) fails on every recent PR regardless of content — confirmed also failing on the just-merged PR #3337. It does not appear to actually gate merging (Mergify showsMerge Protections: skippingon affected PRs), but it means the "check" status is permanently red and not a meaningful signal.One confirmed root cause among these
scripts/agents/issues.agent.cjs:13—const __filename = __filename || process.argv[1];throwsSyntaxError: Identifier '__filename' has already been declaredunder Jest's CommonJS transform, since__filenameis already a module-scope binding there. This breaksscripts/agents/__tests__/issues.agent.test.js(and likelyplanner.agent.test.js, which follows the same../X.agent.cjsrequire pattern per its own failure in the same run — worth checkingplanner.agent.cjsfor the identicalconst __filename = __filename || ...idiom).Suggested approach
__filenameredeclaration pattern likely explains several of the*.agent.test.jsfailures at once).npm run testis clean, consider whethercheckshould become an actual required/blocking status check — right now a permanently-red required-looking check that doesn't block merges is worse than no check.Related
process.exit()-at-import pattern that was also blocking a cleannpm run testrun; already fixed in fix: jest moduleNameMapper regex escaping + release-gates test hang #3341 formetrics-collection-orchestrator.cjs, but the same pattern may recur among these 29).