mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +00:00
ci(server): module mocks, hand-built services and test file length in tests/ may only shrink
lint:test-mocks counts vi.mock/vi.doMock of src/config, src/nest/realtime and src/db per file under tests/, lint:test-new-service counts new XService(/new XRepository( there with every class whose constructor takes nothing allowed (derived from src/ and tests/helpers/), and lint:size holds files under tests/ to 2000 lines against their own baseline. Both counters share scripts/lib/count-ratchet.mjs, which gains a prepare hook for a check that reads the tree first. The three run as steps of the existing server lint job; the CLAUDE.md files and the module guide describe the test helpers they point to.
This commit is contained in:
@@ -280,6 +280,8 @@ jobs:
|
||||
# A source file may hold no more lines than scripts/size-baseline.json
|
||||
# allows (1000 for a file without an entry, long lines counted
|
||||
# wrapped), so a big service is split by concern instead of growing.
|
||||
# Files under tests/ are held the same way at 2000 lines against
|
||||
# scripts/test-size-baseline.json.
|
||||
run: cd server && npm run lint:size
|
||||
|
||||
- name: Shared ratchet code
|
||||
@@ -311,6 +313,18 @@ jobs:
|
||||
# through tests/helpers/factories (MikroORM) instead.
|
||||
run: cd server && npm run lint:test-sql
|
||||
|
||||
- name: Module mocks of config, realtime and db in tests may only shrink
|
||||
# Counts vi.mock/vi.doMock of src/config, src/nest/realtime and src/db
|
||||
# per file under tests/ against scripts/test-mocks-baseline.json. The
|
||||
# setup file fixes the config, a FakeRealtimeService records broadcasts.
|
||||
run: cd server && npm run lint:test-mocks
|
||||
|
||||
- name: Hand-built services in tests may only shrink
|
||||
# Counts new XService(/new XRepository( per file under tests/ against
|
||||
# scripts/test-new-service-baseline.json (classes whose constructor
|
||||
# takes nothing are allowed). New suites use createTestModule.
|
||||
run: cd server && npm run lint:test-new-service
|
||||
|
||||
- name: QueryBuilder calls in the repositories may only shrink
|
||||
# Counts this.qb(...)/createQueryBuilder(...) per file under
|
||||
# src/db/repositories/ against scripts/query-api-baseline.json. New
|
||||
|
||||
Reference in New Issue
Block a user