test: suite de tests automatisés in-process + CI (vitest)#6
Merged
Conversation
Premier filet de non-régression rejouable en CI, SANS infrastructure : tout tourne en mémoire sur les dialectes in-process (sqlite, sql.js, pglite, duckdb). - vitest 4 + config (tests/**/*.test.ts, pool forks, timeouts). - Helpers : createIsolatedDialect (hors singleton/env global) + BaseRepository, paramétrés sur les 4 dialectes in-process. - tests/crud.test.ts : scénario complet ×4 dialectes (60 tests) — schéma, create, relations many-to-one, findById/findOne/findAll, count + count(filter) [couvre la régression de casse d'alias cnt/CNT], update, upsert (idempotent), pagination, delete/deleteMany. - tests/transactions.test.ts : commit (persiste) & rollback (annule) via $transaction(cb) ×4 dialectes (8 tests). - Scripts npm : test (vitest run), test:watch, typecheck (tsc --noEmit). - CI GitHub Actions (.github/workflows/test.yml) : Node 20/22, typecheck + build + test (npm install — package-lock.json non versionné). Total : 68 tests, ~6 s, zéro dépendance serveur. Author: Dr Hamid MADANI <drmdh@msn.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Auteur : Dr Hamid MADANI drmdh@msn.com
Résumé
Premier filet de tests automatisés rejouable en CI, sans aucune infrastructure (ni Docker, ni serveur) : tout tourne en mémoire sur les dialectes in-process — SQLite, sql.js, pglite, DuckDB. Jusqu'ici,
@mostajs/ormn'avait aucun test automatisé (validation 100 % manuelle sur DB réelles).Contenu (1 commit)
vitest.config.ts(pool forks, timeouts,tests/**/*.test.ts).createIsolatedDialect(hors singleton/env global) +BaseRepository, paramétrés sur les 4 dialectes in-process.tests/crud.test.ts(60 tests = scénario complet ×4) : schéma, create, relations many-to-one,findById/findOne/findAll,count+count(filter)(couvre la régression de casse d'aliascnt/CNTcorrigée en 2.10.1),update,upsertidempotent, pagination,delete/deleteMany.tests/transactions.test.ts(8 tests = ×4) : commit (persiste) & rollback (annule) via$transaction(cb).test(vitest run),test:watch,typecheck(tsc --noEmit)..github/workflows/test.yml: Node 20/22,typecheck+build+test(npm install—package-lock.jsonnon versionné).Résultat
68 tests verts en ~6 s, zéro dépendance serveur. Base de non-régression pour les refactors à venir.