Skip to content

test: add tsArch to check for module-structure - #83

Merged
emaarco merged 1 commit into
mainfrom
emaarco/arch-test-src-root
Oct 21, 2026
Merged

emaarco merged 1 commit into
mainfrom
emaarco/arch-test-src-root

Conversation

@emaarco

@emaarco emaarco commented Oct 21, 2026

Copy link
Copy Markdown
Member

Summary

#82 reduced the root of src/ to the entries index.ts, api.ts and cli.ts, but nothing kept it that way. test/architecture.test.ts adds an ArchUnitTS rule that fails when another module lands there. The failure names the file, and CONTRIBUTING.md points to the test.

  • New dev dependency archunit 2.5.4, pinned. It brings its own TypeScript 5.9 for parsing; the repo's TypeScript 7 is unaffected.
  • vitest.config.ts sets globals: true because ArchUnitTS registers toPassAsync() on the global expect. The existing tests import describe/it/expect explicitly and are unaffected.
  • The rule was checked both ways: green on main, and red on a stray src/stray.ts and on a root file without imports. A pattern that matches no file also fails, so a typo in a folder name can't pass silently.

The dependency is meant for the next rules too. The spike already shows what those would catch today: 59 import cycles (type and value imports are marked separately) and 7 imports from query/ into ops/. Those need a list of known violations first, so they are not part of this PR.

Checklist

  • npm run typecheck passes
  • npm run gate passes (2318 tests; one earlier run failed on the timing assertion in step3-ids-report.test.ts under high machine load, which also happened before this change)
  • src/report/guide.ts and the matching page in docs/ are updated (only if a command, option or output changed)
  • PR title is a changelog-worthy Conventional-Commit summary

Linked issue

None.

An ArchUnitTS rule in test/architecture.test.ts fails when a module
lands next to index.ts, api.ts and cli.ts instead of in the folder of
its stage. Vitest runs with globals, which ArchUnitTS needs to register
toPassAsync.
@emaarco
emaarco enabled auto-merge (squash) October 21, 2026 18:13
@emaarco emaarco changed the title test: keep the root of src to the package entries test: add tsArch to check for module-structure Oct 21, 2026
@emaarco
emaarco merged commit da3e8ca into main Oct 21, 2026
7 checks passed
@emaarco
emaarco deleted the emaarco/arch-test-src-root branch October 21, 2026 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant