Skip to content

task: support tests/ and __tests__/ and remove dead root jest.config.js #3469

Open

Description

@eleshar

Part of #3464. Supersedes #3312.

Findings

  • npm test uses .jest.config.cjs, whose testMatch already covers **/tests/**/*.test.{js,ts,mjs} and **/__tests__/**/*.test.{js,ts,mjs}. Jest 30.5.2 is installed (current stable 30.5).
  • Root jest.config.js targets agents/changelog/tests/, which no longer exists (the agent is agents/changelog-agent/). It is dead.
  • Root AGENTS.md requires tests in a matching __tests__/ subtree; spec 014 requires tests/. 17 agents use tests/, 10 use __tests__/.
  • The Jest config proposed in the consolidation guide targets .github/agents/*/tests/ (wrong path for this repo) and drops __tests__/; do not adopt it.

Change

  • Allow both tests/ and __tests__/; document it once in root AGENTS.md and spec 014.
  • Delete root jest.config.js or point it at .jest.config.cjs.
  • Non-JS tests: pytest testpaths, bats under tests/.

Acceptance

  • One documented rule, matching .jest.config.cjs
  • Dead config removed
  • npm test discovers suites in both folder styles

Activity

  1. linear-code commented on Sep 23, 2026

    @linear-code
  2. eleshar commented on Sep 23, 2026

    @eleshar
    ContributorAuthor

    Additional finding: the Jest harness cannot run native-ESM suites under scripts/validation/__tests__/.

    Fix options: set "type": "module" in scripts/validation/package.json with an ESM-aware Jest setup, or disable module transformation (modules: false) for those paths. Until then these suites give no signal in npm test.

  3. eleshar commented on Sep 23, 2026

    @eleshar
    ContributorAuthor

    Correction to my previous comment: the loading failure was caused by the test file itself, not the Jest harness. structure-validation.test.js used import.meta, which Babel cannot transform to CommonJS. Commit 334c1d1 on #3434 replaced it, and the suites now load and pass under the existing .jest.config.cjs (17/17 across structure-validation, skills-registry-validator and skills-registry, both with and without --experimental-vm-modules).

    Remaining point for this issue: any other test that uses import.meta under scripts/ will hit the same error; either avoid it in tests or move those suites to native ESM.

  4. eleshar commented on Oct 3, 2026

    @eleshar
    ContributorAuthor

    Partly addressed by #3711 (merged as 907442298): the broken root jest.config.js is deleted and a root jest.config.cjs now forwards to .jest.config.cjs, so bare npx jest resolves the intended configuration. Measured on the merged tree: bare npx jest --listTests and npx jest --config .jest.config.cjs --listTests both list 315 files and the lists are identical; the full suite passes (315 suites, 6,969 passed, 0 failed). This took the "point it at .jest.config.cjs" option from this issue's change section. The tests/ and __tests__/ support part of this issue is not changed by #3711 and remains open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions