Test suite cannot run: jest config is CJS under "type":"module" (test:coverage dies); after fixing it all 54 suites fail on a bad tsconfig path; test:attention 13/13 fail on AgentDB import
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 812
- Forks
- 175
- Avg merge
- 2m
- Merged PRs (30d)
- 3
Description
Summary
Of the four documented test commands, the two that would actually exercise the repo's TypeScript test suite are broken:
| command | result |
|---|---|
npm test |
✅ exit 0 — 2 assertion tests + a benchmark (see #213) |
npm run test:parallel |
✅ exit 0 — topology benchmark |
npm run test:attention |
❌ exit 1 — 13 of 13 tests fail at beforeAll |
npm run test:coverage |
❌ exit 1 — cannot start; the jest config is CommonJS in an ESM package |
Repairing the config reveals a second blocker: jest then collects 54 suites and all 54 fail to load on a bad tsconfig.json path, so zero tests execute.
Both blockers are one-line fixes. Nothing here is missing — jest, config/jest.config.js and the test files are all present after npm install.
Setup: fresh --depth 1 clone of main, npm install, npm run build (exits 2 per #213 but emits dist/), Node 24, macOS 15.6.
1. test:coverage cannot start — CJS config in an ESM package
$ npm run test:coverage
> jest --coverage --config=config/jest.config.js
ReferenceError: module is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension
and package.json contains "type": "module".
at config/jest.config.js:6:1
config/jest.config.js:6 is module.exports = {, and the root package.json declares "type": "module".
Consequences:
- Coverage has never been runnable on this layout.
coverage:check— the script that enforces the coverage threshold — uses the same--config=config/jest.config.js, so the quality gate is dead too.
Fix: rename to config/jest.config.cjs (verified below), or convert the file to export default.
This is the third occurrence of this exact defect in the project: ruvector-onnx-embeddings-wasm@0.1.2 has the same "type": "module" + CommonJS .js mismatch, which breaks embedding-generation in workers native (#208 §2) and bench:attention (#213). A repo-wide sweep for .js files using module.exports under "type": "module" would likely be worthwhile.
2. Fixing the config exposes a bad tsconfig.json path — all 54 suites fail to load
$ cp config/jest.config.js config/jest.config.cjs
$ npx jest --config=config/jest.config.cjs --listTests | wc -l
54
$ npx jest --config=config/jest.config.cjs
● Test suite failed to run
File not found: <rootDir>/tsconfig.json
(resolved as: <repo>/agentic-flow/config/tsconfig.json)
at ConfigSet.resolvePath (node_modules/ts-jest/dist/legacy/config/config-set.js:616:19)
Test Suites: 54 failed, 54 total
Tests: 0 total
ts-jest resolves <rootDir>/tsconfig.json relative to config/, where no tsconfig.json exists. The real one is at agentic-flow/config/tsconfig.json.
Note Tests: 0 total — that is not a pass, it is nothing ran. Worth being explicit about, because a summary line of 0 failed is easy to misread as success in CI output.
Fix: point ts-jest at the real path, e.g. tsconfig: '<rootDir>/../agentic-flow/config/tsconfig.json' in the transform options.
3. test:attention — 13 of 13 fail on a constructor import
With the shipped config, this one does run (it passes --config=config/jest.config.js too, but jest resolves it differently for a single file):
$ npm run test:attention
Failed to initialize Enhanced AgentDB: agentdb_1.AgentDB is not a constructor
at EnhancedAgentDBWrapper.initialize (agentic-flow/src/core/agentdb-wrapper-enhanced.ts:195:13)
at Object.<anonymous> (tests/integration/attention-gnn.test.ts:44:19)
Test Suites: 1 failed, 1 total
Tests: 13 failed, 13 total
Time: 0.265 s
Every test fails in beforeAll, so none of the attention assertions are ever evaluated.
agentdb_1.AgentDB is not a constructor is a namespace-vs-default import mismatch — the same shape as the ruvector import errors that break the build (#213: Module '"ruvector"' has no exported member 'METAHARNESS_VERSIONS'. Did you mean to use 'import METAHARNESS_VERSIONS from "ruvector"'?) and as the constructor bug behind #186/#189.
Note the installed agentdb is 3.0.0-alpha.20 (declared in package.json), while the architecture docs reference 2.0.0-alpha.2.11 (#217) — worth checking whether the export shape changed across that major.
Why this matters together
The repo contains 104 *.test.ts / *.spec.ts files. Jest is configured to collect 54 of them. npm test runs 2. And after repairing the config, 0 execute.
That gap explains a lot of the other reports: the attention/coordination defects in #191, #193, #215 and #216 are exactly the kind of thing tests/integration/attention-gnn.test.ts exists to catch — it just has never been able to run.
Suggested minimum
config/jest.config.js→config/jest.config.cjs(or convert to ESM).- Point ts-jest at
agentic-flow/config/tsconfig.json. - Fix the
AgentDBimport shape insrc/core/agentdb-wrapper-enhanced.ts. - Then wire
npm testto the jest config (already suggested in #213), so the suite runs on every contribution.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with config/jest.config.js, package.json, and src/core/agentdb-wrapper-enhanced.ts, then run npm run test:coverage and npm run test:attention. Check the ts-jest path against agentic-flow/config/tsconfig.json and inspect the AgentDB export used by the attention test. Done means the Jest suites load, attention assertions execute, coverage runs, and the relevant commands no longer fail at setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- build-system, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100