mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 04:12:10 +03:00
* perf(test): tsx/esm loader, tsx 4.23 bump, orphan tests recovered, CI runs npm scripts Pacote 1 (quick wins) do plano mestre testes+CI: - Swap --import tsx -> --import tsx/esm on the 19 test scripts: the repo is pure ESM and the CJS hook costs ~1.3s PER test process (2,462 processes/run). Measured: bootstrap 2.3s -> 1.1s; real-suite A/B (tests/unit/db, 12 files) 22.2s -> 14.1s wall (-36%), 82/82 pass. Non-test scripts keep the full hook. - Bump tsx ^4.22.3 -> ^4.23.0 (fix for privatenumber/tsx#809 startup regression; helps module resolution on big graphs — hook cost unchanged, honest note). - Recover 22 ORPHAN test files (tests/unit/feature-triage/*.test.mjs, 53 cases, 53/53 pass) that matched no glob and ran in NO CI job; drop the dead 'executors' dir from the braces glob. - Single source of truth for the unit-suite invocation: new test:unit:ci:shard (shard via TEST_SHARD env) called by ci.yml test-unit/node24/node26/coverage and quality.yml fast-unit — closing two silent drifts: CI was NOT importing setupPolyfill.ts, and the fast path glob OMITTED tests/unit/memory + usage. quality.yml TIA step + ci.yml test-integration get the tsx/esm swap only. Validation: full unit suite 21,153 tests / 21,135 pass / 13 skip (5 fails = known load-flake family, 10/10 green rerun isolated); vitest 237/237; smoke db+feature-triage 135/135. Record run 2 = ci.yml workflow_dispatch on the stacked pacote-2 branch (clean runners). * fix(test): dashboard UI tests keep full tsx hook; recover 15 more .mjs orphans; extend discovery gate to .mjs Follow-up do dispatch de validacao (run 28720431562), que pegou 2 problemas reais: 1. tests/unit/dashboard/** (11 arquivos, 102 casos) importam componentes React cujo grafo puxa @lobehub/icons — o build es/ dele faz require() interno de arquivos com sintaxe ESM, que so funciona com o patch CJS do tsx (sem ele: SyntaxError 'Unexpected token export' no CI; local vira crawl de ~60s/arquivo). Esses 11 arquivos rodam agora numa 2a invocacao com --import tsx COMPLETO (mesmo shard), e o resto da suite mantem tsx/esm (-50% bootstrap). Validado: 102/102. 2. check:test-discovery falhou porque ancorava textualmente os globs nos workflows — COLLECTORS atualizado p/ o modelo fonte-unica (ancora = nome do script test:unit:ci:shard nos workflows) + varredura ESTENDIDA a .test.mjs, que era o ponto cego que deixou os orfaos apodrecerem. A extensao revelou +15 orfaos .mjs (top-level + db/) alem dos 22 de feature-triage — TODOS religados via glob tests/unit/**/*.test.mjs (171/171 pass). Um deles (encryption-error-handling) codificava o contrato PRE-hardening (decrypt falho retornava ciphertext cru — vazamento); alinhado ao contrato shipped (null + log) com comentario. Gate: [test-discovery] OK — 2892 arquivos, 22 collectors, 60 orfaos congelados (divida rastreada, shrink-only).