Repository navigation
Open
Description
Problem
.jest.config.cjs testMatch covers *.test.js, *.test.ts and *.test.mjs, but not *.test.cjs. The 20 tracked *.test.cjs files outside archived/ never run, so their failures are invisible.
Forced run (JEST_TEST_MATCH_*="**/*.test.cjs", 2026-09-23): 18 of 20 suites fail, 21 of 118 tests.
Failing suites:
agents/changelog-agent/includes/tests/{keepAChangelogParser,changelogValidator}.test.cjsagents/release-agent/__tests__/{integration,gitOps}.test.cjs,agents/release-agent/includes/tests/{versionManager,repoDetector}.test.cjsagents/wordpress-release-utilities-agent/includes/tests/readmeTxt.test.cjsscripts/automation/__tests__/update-projects-status.test.cjsscripts/validation/__tests__/validate-labels-before-creation.test.cjsscripts/workflows/__tests__/orchestrate-phase-progression.test.cjs(this one only tests helpers defined inside the test file itself)scripts/workflows/changelog/__tests__/{checkout-pr-head,merge-entries.integration,merge-entries,changelog-management}.test.cjsscripts/workflows/metrics/__tests__/metrics-reporting.test.cjsscripts/workflows/projects/__tests__/{scan-completion,archive-projects}.test.cjsscripts/workflows/release/__tests__/trigger-telemetry.test.cjs
Change
- Triage each suite: fix the test or the code, or delete tests that test nothing real.
- Add
**/*.test.cjstotestMatch(bothtests/and__tests__/forms, see task: support tests/ and __tests__/ and remove dead root jest.config.js #3469) once they pass, so they gate CI through fix(ci): no workflow runs the Jest suite, so test regressions merge green #3479.
Acceptance
npx jest --config .jest.config.cjs --listTestsincludes every tracked*.test.cjs, and all of them pass.
Definition of Ready (DoR)
- Bug is reproducible and clearly described
- Steps to reproduce written
- Environment details provided
- Screenshots/logs included (if possible)
- Linked to existing issues/PRs (if any)
- Estimate added (if relevant)
- Ready for triage
- Estimate added (if applicable)
Definition of Done (DoD)
- Issue is fixed and tested
- Bug confirmed and reproducible
- Fix implemented and tested (all supported browsers/devices)
- Documentation updated (if needed)
- Changelog entry prepared for PR (CHANGELOG.md)
- QA performed
- Accessibility: no WCAG 2.2 AA regressions (semantic HTML, keyboard support, colour contrast)
- Performance: no adverse impact introduced
- Branch prefix is correct (fix/)
- Branch deleted after merge
- Linked issue updated with latest status and closed after merge
Metadata
Metadata
Assignees
Type
Fields
Priority
None yet
Activity
linear-code commentedon Sep 23, 2026
LS-4246
eleshar commentedon Sep 30, 2026
Still live on
develop@1a1021eea8— and #3560 is a duplicate of this.jest.config.cjs:27-34ondevelop:Six patterns, three extensions, no
.cjs. The repository carries 20*.test.cjsfiles ondevelop, so none of them is ever selected bynpm test.moduleFileExtensionsat line 47 does listcjs, so the files resolve once selected — it istestMatchalone that excludes them.Duplicate of #3560
#3560 is titled "ci: 20 .test.cjs suites run in no known runner" and reports the same 20 files. #3484 adds the
testMatchdiagnosis and the "18 fail when run" measurement. #3484 is the better-formed of the two — it names the mechanism, this one only observes the absence. One should win and the other close; which is a maintainer call, but merging both would produce two pull requests touching the same six lines of.jest.config.cjs.Note the env-var indirection already in place:
JEST_TEST_MATCH_1…6can override any pattern, so a test can drive the new.cjspattern without editing the file. That is also the fastest way to confirm the 18 failures before committing to the fix.eleshar commentedon Oct 1, 2026
Re-measured on
developatcb955e47dd(ESLint 10.11.0, Jest 30.5.2, Node v24.21.0), each of the 20 tracked*.test.cjsfiles in its own Jest process, because one of them kills the runner and would otherwise hide the rest.Result
3 suites pass · 16 fail · 1 produces no summary at all.
agents/wordpress-release-utilities-agent/includes/tests/pluginHeader.test.cjsagents/wordpress-release-utilities-agent/includes/tests/themeCss.test.cjsscripts/validation/__tests__/validate-labels-before-creation.test.cjsagents/release-agent/__tests__/gitOps.test.cjsagents/release-agent/__tests__/integration.test.cjsagents/wordpress-release-utilities-agent/includes/tests/readmeTxt.test.cjsscripts/workflows/release/__tests__/trigger-telemetry.test.cjsscripts/workflows/changelog/__tests__/merge-entries.test.cjsTests: 0 total,Test Suites: 1 failedTotals across the reporting suites: 19 failed, 99 passed, 118 total.
This reconciles with the 118 total recorded on 2026-09-23 and the 21 failures recorded then: same denominator, 19 failing now. One suite that failed then passes now —
validate-labels-before-creation.test.cjs. The conclusion is unchanged: these are not safe to enable.Two things this issue did not identify
1. Adding
**/*.test.cjstotestMatchis not sufficient. The transform in.jest.config.cjsis:cjsis absent.moduleFileExtensionsalready includescjs, so resolution is fine, but the test files are not transformed. Any proposal that only widenstestMatchneeds this changed too, and it should be verified rather than assumed.2. Eleven suites fail at module load, before registering a single test. They report
Tests: 0 totalrather than a test failure. That is a different defect class from "a test asserts the wrong thing", and it is why the failure count looks small relative to the suite count. These will not be fixed by adjusting expectations.3.
merge-entries.test.cjscallsprocess.exit(), at line 223:This terminates the whole Jest worker. In a single run with all 20 enabled, the run dies there with no summary at all — which is exactly what happened when I forced the full set.
.jest.config.cjsalready excludes four sibling.jsscripts fromtestPathIgnorePatternsfor this reason, with a comment saying each "callsprocess.exit()directly, which crashes the Jest worker instead of reporting a failure". These files need the same treatment or a rewrite.Why no pull request
Enabling these is unsafe on the evidence above: 17 of 20 do not pass, and one is not even a Jest suite as written. This is triage work across 17 suites, which is a change of a different shape and should not ride along with a configuration change.
Related: #3560 covers the same files from the "which runner owns each file" angle. On the evidence here I would keep #3484 as the tracker and close #3560 as the duplicate — #3484 states the defect and its acceptance criterion, whereas #3560 proposes migrating to
.test.jsor wiring package-local runners, and this measurement shows neither helps until the suites actually pass.eleshar commentedon Oct 3, 2026
Context from #3711 (merged as
907442298): before it, barenpx jestfound no configuration and fell back to Jest's built-in defaults, which did match the 20*.test.cjssuites. With the new rootjest.config.cjsforwarding to.jest.config.cjs, bare Jest now discovers exactly what the intended configuration does, and that configuration'stestMatchdoes not include.cjstest files. So these suites are still not run bynpm test, and bare Jest no longer picks them up either. This issue is unchanged: they still need a decision to be included intestMatch(and the failing ones fixed) or run by their own runner.[-]test: 20 *.test.cjs files never run (testMatch omits .cjs); 18 fail when run[/-][+]fix: jest - Run and repair excluded CJS tests[/+]