@roomi-fields/grillhouse 0.29.0 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +769 -0
- package/agents/developpeur.md +0 -1
- package/agents/explorateur.md +0 -1
- package/agents/questionneur.md +0 -1
- package/agents/testwriter.md +0 -1
- package/bin/grillhouse.mjs +79 -18
- package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
- package/cadre/templates/projet/CLAUDE.md +5 -1
- package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
- package/cadre/templates/projet/package.json +2 -2
- package/charte.md +24 -0
- package/dist/temporal/acte.d.ts +24 -0
- package/dist/temporal/acte.js +139 -0
- package/dist/temporal/acte.js.map +1 -0
- package/dist/temporal/attributs.d.ts +6 -0
- package/dist/temporal/attributs.js +15 -0
- package/dist/temporal/attributs.js.map +1 -0
- package/dist/temporal/circuit/activites.d.ts +13 -0
- package/dist/temporal/circuit/activites.js +33 -0
- package/dist/temporal/circuit/activites.js.map +1 -0
- package/dist/temporal/circuit/client.d.ts +72 -0
- package/dist/temporal/circuit/client.js +247 -0
- package/dist/temporal/circuit/client.js.map +1 -0
- package/dist/temporal/circuit/commande.d.ts +2 -0
- package/dist/temporal/circuit/commande.js +238 -0
- package/dist/temporal/circuit/commande.js.map +1 -0
- package/dist/temporal/circuit/contrat.d.ts +305 -0
- package/dist/temporal/circuit/contrat.js +30 -0
- package/dist/temporal/circuit/contrat.js.map +1 -0
- package/dist/temporal/circuit/deroule.d.ts +3 -0
- package/dist/temporal/circuit/deroule.js +540 -0
- package/dist/temporal/circuit/deroule.js.map +1 -0
- package/dist/temporal/client.d.ts +47 -0
- package/dist/temporal/client.js +69 -0
- package/dist/temporal/client.js.map +1 -0
- package/dist/temporal/commande.d.ts +2 -0
- package/dist/temporal/commande.js +94 -0
- package/dist/temporal/commande.js.map +1 -0
- package/dist/temporal/deroules.d.ts +5 -0
- package/dist/temporal/deroules.js +10 -0
- package/dist/temporal/deroules.js.map +1 -0
- package/dist/temporal/etat.d.ts +33 -0
- package/dist/temporal/etat.js +59 -0
- package/dist/temporal/etat.js.map +1 -0
- package/dist/temporal/file/activites.d.ts +10 -0
- package/dist/temporal/file/activites.js +25 -0
- package/dist/temporal/file/activites.js.map +1 -0
- package/dist/temporal/file/client.d.ts +4 -0
- package/dist/temporal/file/client.js +6 -0
- package/dist/temporal/file/client.js.map +1 -0
- package/dist/temporal/file/contrat.d.ts +158 -0
- package/dist/temporal/file/contrat.js +14 -0
- package/dist/temporal/file/contrat.js.map +1 -0
- package/dist/temporal/file/deroule.d.ts +15 -0
- package/dist/temporal/file/deroule.js +235 -0
- package/dist/temporal/file/deroule.js.map +1 -0
- package/dist/temporal/installation.d.ts +120 -0
- package/dist/temporal/installation.js +386 -0
- package/dist/temporal/installation.js.map +1 -0
- package/dist/temporal/places/activites.d.ts +8 -0
- package/dist/temporal/places/activites.js +13 -0
- package/dist/temporal/places/activites.js.map +1 -0
- package/dist/temporal/places/client.d.ts +28 -0
- package/dist/temporal/places/client.js +64 -0
- package/dist/temporal/places/client.js.map +1 -0
- package/dist/temporal/places/contrat.d.ts +106 -0
- package/dist/temporal/places/contrat.js +21 -0
- package/dist/temporal/places/contrat.js.map +1 -0
- package/dist/temporal/places/deroule.d.ts +3 -0
- package/dist/temporal/places/deroule.js +198 -0
- package/dist/temporal/places/deroule.js.map +1 -0
- package/dist/temporal/sonde/activites.d.ts +6 -0
- package/dist/temporal/sonde/activites.js +52 -0
- package/dist/temporal/sonde/activites.js.map +1 -0
- package/dist/temporal/sonde/contrat.d.ts +35 -0
- package/dist/temporal/sonde/contrat.js +10 -0
- package/dist/temporal/sonde/contrat.js.map +1 -0
- package/dist/temporal/sonde/deroule.d.ts +3 -0
- package/dist/temporal/sonde/deroule.js +39 -0
- package/dist/temporal/sonde/deroule.js.map +1 -0
- package/dist/temporal/tickets/activites.d.ts +7 -0
- package/dist/temporal/tickets/activites.js +81 -0
- package/dist/temporal/tickets/activites.js.map +1 -0
- package/dist/temporal/tickets/client.d.ts +10 -0
- package/dist/temporal/tickets/client.js +31 -0
- package/dist/temporal/tickets/client.js.map +1 -0
- package/dist/temporal/tickets/contrat.d.ts +56 -0
- package/dist/temporal/tickets/contrat.js +13 -0
- package/dist/temporal/tickets/contrat.js.map +1 -0
- package/dist/temporal/tickets/deroule.d.ts +3 -0
- package/dist/temporal/tickets/deroule.js +94 -0
- package/dist/temporal/tickets/deroule.js.map +1 -0
- package/dist/temporal/travailleur.d.ts +2 -0
- package/dist/temporal/travailleur.js +69 -0
- package/dist/temporal/travailleur.js.map +1 -0
- package/docs/ARCHITECTURE.md +646 -87
- package/docs/CADRE.md +27 -0
- package/docs/INTERFACE.md +139 -42
- package/hooks/crochet.mjs +19 -2
- package/hooks/hooks.json +11 -0
- package/package.json +16 -4
- package/scripts/activites.mjs +2255 -0
- package/scripts/aiguillage.d.mts +37 -0
- package/scripts/aiguillage.mjs +40 -14
- package/scripts/avancement.mjs +155 -26
- package/scripts/bilan.mjs +137 -43
- package/scripts/cadre.mjs +16 -4
- package/scripts/circuit.mjs +993 -4075
- package/scripts/circuits-cles.d.mts +4 -0
- package/scripts/circuits-cles.mjs +21 -0
- package/scripts/circuits-du-serveur.mjs +105 -0
- package/scripts/codes-de-sortie.mjs +9 -0
- package/scripts/commandes-composees.mjs +45 -41
- package/scripts/commandes-du-path.d.mts +7 -0
- package/scripts/commandes-du-path.mjs +25 -0
- package/scripts/composants-affectes.mjs +64 -21
- package/scripts/composition-des-langages.mjs +18 -12
- package/scripts/conformite.mjs +56 -28
- package/scripts/copies-finies.mjs +52 -47
- package/scripts/depart-du-ticket.d.mts +53 -0
- package/scripts/depart-du-ticket.mjs +124 -0
- package/scripts/dependances-internes.mjs +121 -0
- package/scripts/dernier-vert.mjs +61 -34
- package/scripts/dette.mjs +32 -11
- package/scripts/donnees-cles.mjs +244 -0
- package/scripts/droits.mjs +51 -16
- package/scripts/effets.mjs +352 -0
- package/scripts/empreinte-d-etape.mjs +17 -0
- package/scripts/engendres.mjs +15 -5
- package/scripts/enveloppe/enveloppe.mjs +259 -55
- package/scripts/enveloppe/lancer.sh +14 -18
- package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
- package/scripts/enveloppe/travail-de-la-copie.mjs +41 -13
- package/scripts/etapes.mjs +5 -2
- package/scripts/faits-du-circuit.mjs +493 -0
- package/scripts/file-des-tickets.d.mts +21 -0
- package/scripts/file-des-tickets.mjs +58 -0
- package/scripts/flux-des-paquets.mjs +201 -0
- package/scripts/gardes-du-cadre.mjs +21 -5
- package/scripts/init.mjs +11 -4
- package/scripts/integration/file.mjs +544 -434
- package/scripts/integration/integrer.mjs +87 -43
- package/scripts/integration/rejeu.mjs +45 -13
- package/scripts/jointure.d.ts +151 -28
- package/scripts/langages/cargo/commandes.mjs +383 -124
- package/scripts/langages/cargo/composants.mjs +154 -42
- package/scripts/langages/cargo/exemples.mjs +12 -21
- package/scripts/langages/cargo/index.mjs +22 -8
- package/scripts/langages/cargo/sccache.mjs +8 -14
- package/scripts/langages/cargo/tests-de-head.mjs +25 -9
- package/scripts/langages/python/commandes.mjs +218 -100
- package/scripts/langages/python/composants.mjs +53 -21
- package/scripts/langages/python/exemples.mjs +6 -16
- package/scripts/langages/python/index.mjs +28 -8
- package/scripts/langages/python/lot.mjs +1 -36
- package/scripts/langages/typescript/chemins-des-tests.mjs +6 -2
- package/scripts/langages/typescript/composants.mjs +9 -3
- package/scripts/langages/typescript/consommateurs-arbitres.mjs +40 -14
- package/scripts/langages/typescript/consommateurs.mjs +39 -14
- package/scripts/langages/typescript/construire.mjs +6 -163
- package/scripts/langages/typescript/elements-du-lot.mjs +36 -12
- package/scripts/langages/typescript/exemples.mjs +3 -11
- package/scripts/langages/typescript/frontieres.mjs +66 -22
- package/scripts/langages/typescript/index-interfaces.mjs +36 -13
- package/scripts/langages/typescript/index.mjs +50 -61
- package/scripts/langages/typescript/interfaces-contre-code.mjs +113 -45
- package/scripts/langages/typescript/lecteurs.mjs +36 -11
- package/scripts/langages/typescript/migrations/0.23.0-config-vitest.mjs +15 -5
- package/scripts/langages/typescript/migrations/0.25.0-chemins-des-tests.mjs +6 -2
- package/scripts/langages/typescript/migrations/0.25.0-tailles-des-tests.mjs +6 -2
- package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
- package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +33 -0
- package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
- package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
- package/scripts/langages/typescript/parcours.mjs +12 -4
- package/scripts/langages/typescript/regle-des-tests.mjs +9 -3
- package/scripts/langages/typescript/resumes.mjs +9 -3
- package/scripts/langages/typescript/tailles-des-tests.mjs +93 -20
- package/scripts/langages/typescript/tests-de-nuit.mjs +15 -10
- package/scripts/langages/typescript/tests.mjs +40 -15
- package/scripts/langages/typescript/titres-de-tests.mjs +320 -0
- package/scripts/langages/typescript/turbo-des-paquets.mjs +327 -81
- package/scripts/langages/typescript/verdict.mjs +4 -2
- package/scripts/langages/typescript/verifier.mjs +58 -20
- package/scripts/langages/typescript/vitest-config/avancement.reporter.mjs +15 -5
- package/scripts/langages/typescript/vitest-config/base.mjs +29 -3
- package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
- package/scripts/langages/typescript/vitest-config/changements.mjs +21 -8
- package/scripts/langages/typescript/vitest-config/cibles.mjs +36 -14
- package/scripts/langages/typescript/vitest-config/delais.mjs +60 -0
- package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
- package/scripts/langages/typescript/vitest-config/duree.classement.mjs +108 -0
- package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +56 -59
- package/scripts/langages/typescript/vitest-config/lances.mjs +83 -27
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +10 -0
- package/scripts/langages/typescript/vitest-config/resultats.mjs +3 -1
- package/scripts/langages/typescript/vitest.nuit.config.mjs +4 -0
- package/scripts/lint-des-scripts.mjs +58 -0
- package/scripts/mesure/base-de-passe.mjs +117 -25
- package/scripts/mesure/pression.mjs +12 -6
- package/scripts/mesure-de-la-machine.d.mts +21 -0
- package/scripts/mesure-de-la-machine.mjs +76 -0
- package/scripts/migrations/0.23.0-charte-importee.mjs +6 -2
- package/scripts/migrations/0.23.0-crochets-de-seance.mjs +25 -8
- package/scripts/migrations/0.23.0-marche-du-projet.mjs +18 -6
- package/scripts/migrations/0.23.2-copies-du-cadre.mjs +56 -18
- package/scripts/migrations/0.24.12-tri-des-decouvertes.mjs +6 -2
- package/scripts/migrations/0.25.0-script-des-tests.mjs +15 -5
- package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +124 -0
- package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
- package/scripts/migrations.mjs +5 -0
- package/scripts/nuit.sh +25 -3
- package/scripts/outil.mjs +3 -1
- package/scripts/outils-cles.d.mts +24 -0
- package/scripts/outils-cles.mjs +18 -8
- package/scripts/paquet-npm.mjs +157 -0
- package/scripts/paquet.mjs +73 -4
- package/scripts/paquets.mjs +46 -10
- package/scripts/passe-de-la-machine.mjs +71 -0
- package/scripts/places-de-la-machine.mjs +414 -0
- package/scripts/places-du-serveur.mjs +170 -0
- package/scripts/prefixe-des-tickets.mjs +68 -0
- package/scripts/preparation.mjs +25 -8
- package/scripts/registre.mjs +9 -4
- package/scripts/regles-des-places.d.mts +36 -0
- package/scripts/regles-des-places.mjs +70 -0
- package/scripts/reponses-du-circuit.d.mts +6 -0
- package/scripts/reponses-du-circuit.mjs +28 -0
- package/scripts/reprise.mjs +66 -0
- package/scripts/resultats.mjs +112 -46
- package/scripts/retirer-les-copies-finies.mjs +25 -0
- package/scripts/sans-reponse.d.mts +4 -0
- package/scripts/sans-reponse.mjs +13 -0
- package/scripts/seances.mjs +936 -0
- package/scripts/services-du-noyau.mjs +27 -8
- package/scripts/session-start.sh +2 -2
- package/scripts/sortie.mjs +3 -3
- package/scripts/sous-commandes.mjs +41 -10
- package/scripts/style-a-l-ecriture.mjs +260 -0
- package/scripts/superviseur.mjs +122 -111
- package/scripts/tableau.mjs +180 -117
- package/scripts/taches-du-graphe.mjs +348 -0
- package/scripts/ticket-du-circuit.mjs +216 -0
- package/scripts/transitions.d.mts +148 -0
- package/scripts/transitions.mjs +1018 -0
- package/scripts/verrou-de-fichier.mjs +8 -4
- package/scripts/verrou-de-machine.mjs +150 -51
- package/scripts/verrous/commande.mjs +50 -17
- package/scripts/verrous/ticket-du-sous-agent.mjs +9 -3
- package/scripts/verrous/verrou.mjs +42 -14
- package/skills/explorateur/SKILL.md +9 -2
- package/skills/grill/SKILL.md +1 -1
- package/skills/mesure/SKILL.md +3 -0
- package/skills/pitmaster/SKILL.md +17 -18
- package/skills/pitmaster/references/consigne-agent.md +5 -1
- package/skills/release/SKILL.md +3 -3
- package/skills/relecteur/SKILL.md +5 -3
- package/skills/testwriter/SKILL.md +49 -31
- package/scripts/demon.mjs +0 -251
- package/scripts/integration/file-attente.mjs +0 -61
- package/scripts/langages/cargo/touches.mjs +0 -93
- package/scripts/langages/typescript/script-des-tests.mjs +0 -6
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
} from 'node:fs';
|
|
22
22
|
import path from 'node:path';
|
|
23
23
|
import { RESULTATS } from '../../resultats.mjs';
|
|
24
|
-
import { SCRIPT_DES_TESTS } from '
|
|
24
|
+
import { SCRIPT_DES_TESTS } from '../../services-du-noyau.mjs';
|
|
25
25
|
import { VITEST } from './vitest-config/resultats.mjs';
|
|
26
26
|
|
|
27
27
|
const TURBO = 'turbo';
|
|
@@ -56,7 +56,9 @@ export function garderLesResumes(racine, avant, env = process.env) {
|
|
|
56
56
|
// The results directory may lie on another file system: a copy, then the removal.
|
|
57
57
|
copyFileSync(path.join(runs, f), path.join(dossier, TURBO, f));
|
|
58
58
|
rmSync(path.join(runs, f), { force: true });
|
|
59
|
-
} else
|
|
59
|
+
} else {
|
|
60
|
+
rmSync(path.join(runs, f), { force: true });
|
|
61
|
+
}
|
|
60
62
|
}
|
|
61
63
|
if (neufs.length && !avant.size && existsSync(runs) && readdirSync(runs).length === 0) {
|
|
62
64
|
rmdirSync(runs);
|
|
@@ -16,7 +16,11 @@
|
|
|
16
16
|
// and so do the builds. The changes reach Vitest in a variable no hash counts
|
|
17
17
|
// (`GRILLHOUSE_CHANGEMENTS`). Without a last green that counts, the pass is complete. The
|
|
18
18
|
// line `↳` says which. A pass green, restricted by no filter, keeps its tree as the last green;
|
|
19
|
-
// a red one keeps the last green as it was.
|
|
19
|
+
// a red one keeps the last green as it was. The pass is the one that keeps it, for every language
|
|
20
|
+
// of the project: it plays the tasks of every package of the graph, a crate's and a Python
|
|
21
|
+
// project's beside a TypeScript package's (their `test:unit` and `typecheck`, scripts of their
|
|
22
|
+
// package.json), so it is green only when every task of every language is, and no module of
|
|
23
|
+
// language keeps a green of its own (scripts/dernier-vert.mjs).
|
|
20
24
|
// - `--tout`, and `--force` (the night, scripts/nuit.sh), play the complete pass: no measure
|
|
21
25
|
// against the last green, and each task of tests played for real (the variable of the tests
|
|
22
26
|
// carries the moment of the pass, `rejouer`, which no cached run holds).
|
|
@@ -43,8 +47,15 @@
|
|
|
43
47
|
// its patterns and the benchmarks of Chromium and rustc-perf leave the CI of each commit for a
|
|
44
48
|
// machine at rest. The day waits for no rest: a delay past is a red (the duration reporter
|
|
45
49
|
// classifies a delay of a day test as a real red), and so is a task at 75.
|
|
46
|
-
// -
|
|
47
|
-
//
|
|
50
|
+
// - The pass plays too the format check and the lint (grillhouse-61z, grillhouse-44b.9), per
|
|
51
|
+
// package: the scripts `format:check` and `lint` of each package that holds them, as its tasks
|
|
52
|
+
// (`<package>#format:check`, `<package>#lint`), and the root's for its own files only, as root
|
|
53
|
+
// tasks (`//#format:check`, `//#lint`), under the same `--continue`: a red lint hides no red
|
|
54
|
+
// test, each red is named with its package. The CI calls the pass alone.
|
|
55
|
+
// - `--gardes` plays the tasks of guards and these two controls alone, `turbo run grillhouse:gardes
|
|
56
|
+
// gardes format:check lint …`, the repository whole (ESLint and Prettier have no notion of a lot;
|
|
57
|
+
// their cache reads again what changed), with the same verdict: what the reviewer plays on the
|
|
58
|
+
// ticket's copy, the tests aside.
|
|
48
59
|
// - The verdict reads the exit code of each task in the summary of each run
|
|
49
60
|
// (`.turbo/runs/<id>.json`), since Turborepo exits with the greatest code of its tasks (a 75
|
|
50
61
|
// would hide a 1). The summary each run writes is removed, and `.turbo/runs` with it when the
|
|
@@ -80,7 +91,7 @@ import { pathToFileURL } from 'node:url';
|
|
|
80
91
|
import {
|
|
81
92
|
AttenteDeLaMachine,
|
|
82
93
|
AVANCEMENT,
|
|
83
|
-
|
|
94
|
+
avecLaMachineEtUnePlace,
|
|
84
95
|
CHANGEMENTS,
|
|
85
96
|
garderLeTotal,
|
|
86
97
|
garderLeVert,
|
|
@@ -88,13 +99,15 @@ import {
|
|
|
88
99
|
nommerLAvancement,
|
|
89
100
|
ouvrirAvancement,
|
|
90
101
|
ouvrirBase,
|
|
102
|
+
PASSE_ROUGE,
|
|
91
103
|
retirerALInterruption,
|
|
104
|
+
SCRIPT_DES_TESTS,
|
|
105
|
+
TESTS_CIBLES,
|
|
106
|
+
testsCibles,
|
|
92
107
|
} from '../../services-du-noyau.mjs';
|
|
93
108
|
import { paquets, TYPAGE } from '../../paquets.mjs';
|
|
94
|
-
import { planifier } from './turbo-des-paquets.mjs';
|
|
95
|
-
import { SCRIPT_DES_TESTS } from './script-des-tests.mjs';
|
|
109
|
+
import { controlesDuDepot, planifier } from './turbo-des-paquets.mjs';
|
|
96
110
|
import { garderLesResumes } from './verdict.mjs';
|
|
97
|
-
import { VARIABLE as TESTS_CIBLES } from './vitest-config/cibles.mjs';
|
|
98
111
|
|
|
99
112
|
const GARDES = ['grillhouse:gardes', 'gardes'];
|
|
100
113
|
const TACHES = [...GARDES, TYPAGE, SCRIPT_DES_TESTS];
|
|
@@ -128,7 +141,7 @@ export function verifier({
|
|
|
128
141
|
const base = ouvrirBase('verification', { dans: env.TMPDIR || tmpdir() });
|
|
129
142
|
const lacher = retirerALInterruption(base.fermer);
|
|
130
143
|
try {
|
|
131
|
-
return
|
|
144
|
+
return avecLaMachineEtUnePlace(
|
|
132
145
|
envMachine => {
|
|
133
146
|
// The progress of the pass: the directory its caller names (the circuit's), else its own,
|
|
134
147
|
// named beside the lock of the machine, which it holds, while it plays.
|
|
@@ -147,7 +160,7 @@ export function verifier({
|
|
|
147
160
|
} finally {
|
|
148
161
|
effacer();
|
|
149
162
|
if (propre) {
|
|
150
|
-
garderLeTotal(dossier
|
|
163
|
+
garderLeTotal(dossier);
|
|
151
164
|
rmSync(dossier, { recursive: true, force: true });
|
|
152
165
|
}
|
|
153
166
|
}
|
|
@@ -155,7 +168,9 @@ export function verifier({
|
|
|
155
168
|
{ env, racine, dire }
|
|
156
169
|
);
|
|
157
170
|
} catch (e) {
|
|
158
|
-
if (!(e instanceof AttenteDeLaMachine))
|
|
171
|
+
if (!(e instanceof AttenteDeLaMachine)) {
|
|
172
|
+
throw e;
|
|
173
|
+
}
|
|
159
174
|
dire(e.message);
|
|
160
175
|
return e.code;
|
|
161
176
|
} finally {
|
|
@@ -184,13 +199,23 @@ function depotAvecTests(racine) {
|
|
|
184
199
|
// Whether <args> hold a filter of Turborepo (`--filter=<f>`, `--filter <f>`, `-F <f>`).
|
|
185
200
|
const filtre = args => args.some(a => a.startsWith('--filter=') || a === '--filter' || a === '-F');
|
|
186
201
|
|
|
202
|
+
// A pass green on every package keeps its tree as the last green (`garder`): not when it is
|
|
203
|
+
// restricted by a filter, measured against nothing, or run after a red module (PASSE_ROUGE).
|
|
204
|
+
export function poserLeVert({ code, etat, args, env, garder }) {
|
|
205
|
+
if (code === 0 && etat && !filtre(args) && !env[PASSE_ROUGE]) {
|
|
206
|
+
garder(etat);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
187
210
|
function passe({ racine, demandes, env, dire, coeurs }) {
|
|
188
211
|
const gardesSeules = demandes.includes('--gardes');
|
|
189
212
|
const tout = demandes.includes('--tout') || demandes.includes('--force');
|
|
190
213
|
const args = demandes.filter(a => a !== '--gardes' && a !== '--tout');
|
|
191
214
|
// The measure against the last green: the guards alone need none.
|
|
192
215
|
const m = gardesSeules ? null : mesure(racine, { tout, dans: env.TMPDIR });
|
|
193
|
-
if (m)
|
|
216
|
+
if (m) {
|
|
217
|
+
dire(m.ligne);
|
|
218
|
+
}
|
|
194
219
|
const taches = new Set();
|
|
195
220
|
try {
|
|
196
221
|
const code = jouerLaPasse({
|
|
@@ -204,10 +229,11 @@ function passe({ racine, demandes, env, dire, coeurs }) {
|
|
|
204
229
|
coeurs,
|
|
205
230
|
taches,
|
|
206
231
|
});
|
|
207
|
-
if (env[ROUGES])
|
|
232
|
+
if (env[ROUGES]) {
|
|
208
233
|
writeFileSync(env[ROUGES], [...taches].map(t => `${t}\t${rejeu(t)}\n`).join(''));
|
|
234
|
+
}
|
|
209
235
|
// A pass green on every package keeps its tree as the last green.
|
|
210
|
-
|
|
236
|
+
poserLeVert({ code, etat: m?.etat, args, env, garder: garderLeVert });
|
|
211
237
|
return code;
|
|
212
238
|
} finally {
|
|
213
239
|
m?.retirer();
|
|
@@ -224,12 +250,13 @@ function jouerLaPasse({ racine, gardesSeules, args, tout, ajouts, env, dire, coe
|
|
|
224
250
|
...propre,
|
|
225
251
|
...ajouts,
|
|
226
252
|
...(tout
|
|
227
|
-
? { [TESTS_CIBLES]: JSON.stringify({ arguments: [],
|
|
253
|
+
? { [TESTS_CIBLES]: JSON.stringify(testsCibles({ arguments: [], force: true })) }
|
|
228
254
|
: {}),
|
|
229
255
|
};
|
|
230
256
|
const borne = args.some(a => CONCURRENCE.test(a)) ? [] : [`--concurrency=${concurrence(coeurs)}`];
|
|
231
257
|
const a = [
|
|
232
258
|
...(gardesSeules ? GARDES : TACHES),
|
|
259
|
+
...controlesDuDepot(racine),
|
|
233
260
|
'--continue=dependencies-successful',
|
|
234
261
|
...borne,
|
|
235
262
|
...args,
|
|
@@ -257,8 +284,12 @@ function jouerLaPasse({ racine, gardesSeules, args, tout, ajouts, env, dire, coe
|
|
|
257
284
|
}
|
|
258
285
|
}
|
|
259
286
|
garderLesResumes(racine, avant, e);
|
|
260
|
-
if (!existait && existsSync(runs) && lister(runs).length === 0)
|
|
261
|
-
|
|
287
|
+
if (!existait && existsSync(runs) && lister(runs).length === 0) {
|
|
288
|
+
rmdirSync(runs);
|
|
289
|
+
}
|
|
290
|
+
if (r.status === 0) {
|
|
291
|
+
return 0;
|
|
292
|
+
}
|
|
262
293
|
|
|
263
294
|
// The verdict of each task: any code but 0 is a red, named.
|
|
264
295
|
const rouges = [];
|
|
@@ -269,14 +300,21 @@ function jouerLaPasse({ racine, gardesSeules, args, tout, ajouts, env, dire, coe
|
|
|
269
300
|
} else {
|
|
270
301
|
for (const t of resume.tasks) {
|
|
271
302
|
const code = t.execution?.exitCode;
|
|
272
|
-
if (code === 0)
|
|
303
|
+
if (code === 0) {
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
273
306
|
rouges.push(`${t.taskId} (code ${code ?? 'absent'})`);
|
|
274
|
-
if (typeof code === 'number')
|
|
307
|
+
if (typeof code === 'number') {
|
|
308
|
+
taches.add(t.taskId);
|
|
309
|
+
}
|
|
275
310
|
}
|
|
276
|
-
if (rouges.length === 0)
|
|
311
|
+
if (rouges.length === 0) {
|
|
277
312
|
rouges.push(`Turborepo sort en ${r.status ?? r.signal} sans tâche en échec`);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
for (const l of rouges) {
|
|
316
|
+
dire(`⛔ ${l}`);
|
|
278
317
|
}
|
|
279
|
-
for (const l of rouges) dire(`⛔ ${l}`);
|
|
280
318
|
dire('⛔ rouge.');
|
|
281
319
|
return 1;
|
|
282
320
|
}
|
|
@@ -10,7 +10,9 @@ import { AVANCEMENT, ecrireTache } from '../../../services-du-noyau.mjs';
|
|
|
10
10
|
// The reporter of progress under <env>'s progress directory, as Vitest's `reporters` take it; an
|
|
11
11
|
// empty list without the variable.
|
|
12
12
|
export function rapportAvancement(env = process.env) {
|
|
13
|
-
if (!env[AVANCEMENT])
|
|
13
|
+
if (!env[AVANCEMENT]) {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
14
16
|
return [fileURLToPath(import.meta.url)];
|
|
15
17
|
}
|
|
16
18
|
|
|
@@ -49,16 +51,24 @@ export default class AvancementReporter {
|
|
|
49
51
|
let change = false;
|
|
50
52
|
for (const [id, resultat] of paquets) {
|
|
51
53
|
const t = this.ctx?.state?.idMap?.get(id);
|
|
52
|
-
if (!t?.filepath || t.file !== t || !FINIS.has(resultat?.state))
|
|
53
|
-
|
|
54
|
+
if (!t?.filepath || t.file !== t || !FINIS.has(resultat?.state)) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (this.faits.has(id)) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
54
60
|
this.faits.add(id);
|
|
55
61
|
change = true;
|
|
56
62
|
}
|
|
57
|
-
if (change)
|
|
63
|
+
if (change) {
|
|
64
|
+
this.ecrire();
|
|
65
|
+
}
|
|
58
66
|
}
|
|
59
67
|
|
|
60
68
|
onFinished(fichiers = []) {
|
|
61
|
-
for (const f of fichiers)
|
|
69
|
+
for (const f of fichiers) {
|
|
70
|
+
this.faits.add(f.id);
|
|
71
|
+
}
|
|
62
72
|
this.ecrire();
|
|
63
73
|
}
|
|
64
74
|
}
|
|
@@ -27,6 +27,10 @@
|
|
|
27
27
|
// tests Vitest relates to the files changed since it (`GRILLHOUSE_CHANGEMENTS`,
|
|
28
28
|
// ./changements.mjs). `mergeConfig` adds the plugins of a configuration that extends this one to
|
|
29
29
|
// it.
|
|
30
|
+
// - A test has the delay of its size, as in Bazel (the delays are in ./bornes.mjs), the size read
|
|
31
|
+
// by the classification of the guard of the sizes, one address (./delais.mjs, applied to each
|
|
32
|
+
// test file by ./delais.setup.mjs). `slowTestThreshold` marks the slow tests, and the duration
|
|
33
|
+
// reporter names the 20 slowest files and their share of the time.
|
|
30
34
|
// - The common environment: Node, no watch, and git's settings for the tests by the environment
|
|
31
35
|
// (GIT_CONFIG_COUNT/KEY/VALUE, git-config(1)), the automatic maintenance and garbage collection
|
|
32
36
|
// off (maintenance.auto=false, gc.auto=0). This file is the one address of these settings; the
|
|
@@ -62,7 +66,12 @@
|
|
|
62
66
|
// task at each test file done, which the board reads (scripts/avancement.mjs,
|
|
63
67
|
// scripts/tableau.mjs).
|
|
64
68
|
import { fileURLToPath } from 'node:url';
|
|
65
|
-
import {
|
|
69
|
+
import {
|
|
70
|
+
ligneDesRestes,
|
|
71
|
+
ouvrirBase,
|
|
72
|
+
retirerALInterruption,
|
|
73
|
+
travailleursDeLaSeance,
|
|
74
|
+
} from '../../../services-du-noyau.mjs';
|
|
66
75
|
import { ciblage, HORS_DU_JOUR } from './cibles.mjs';
|
|
67
76
|
import { rapportAvancement } from './avancement.reporter.mjs';
|
|
68
77
|
import { rapportJson } from './resultats.mjs';
|
|
@@ -100,13 +109,18 @@ function baseDeVitest() {
|
|
|
100
109
|
return {
|
|
101
110
|
name: 'grillhouse:base-de-passe',
|
|
102
111
|
config() {
|
|
103
|
-
if (process.env[MARQUE]?.startsWith(`${process.pid}:`))
|
|
112
|
+
if (process.env[MARQUE]?.startsWith(`${process.pid}:`)) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
104
115
|
const b = ouvrirBase('vitest');
|
|
105
116
|
process.env[MARQUE] = `${process.pid}:${b.base}`;
|
|
106
117
|
Object.assign(process.env, b.env);
|
|
107
118
|
retirerALInterruption(b.fermer);
|
|
108
119
|
process.on('exit', () => {
|
|
109
|
-
const ligne = ligneDesRestes(
|
|
120
|
+
const ligne = ligneDesRestes([
|
|
121
|
+
...b.restes().filter(n => !CACHES_DES_OUTILS.has(n)),
|
|
122
|
+
...b.essais(),
|
|
123
|
+
]);
|
|
110
124
|
if (ligne) {
|
|
111
125
|
process.stderr.write(`${ligne}\n`);
|
|
112
126
|
process.exitCode = 1;
|
|
@@ -130,11 +144,23 @@ export default {
|
|
|
130
144
|
},
|
|
131
145
|
exclude: ['**/node_modules/**', '**/dist/**', ...HORS_DU_JOUR],
|
|
132
146
|
reporters: ['default', ici('./duree.reporter.mjs'), ...rapportJson(), ...rapportAvancement()],
|
|
147
|
+
// The slow-test mark of the report, in ms: Vitest's default, fixed, apart from the delays.
|
|
148
|
+
slowTestThreshold: 300,
|
|
133
149
|
setupFiles: [
|
|
150
|
+
ici('./delais.setup.mjs'),
|
|
134
151
|
ici('./mesure.setup.mjs'),
|
|
135
152
|
ici('./machine.setup.mjs'),
|
|
136
153
|
ici('./resultats.setup.mjs'),
|
|
137
154
|
],
|
|
138
155
|
watch: false,
|
|
156
|
+
...travailleurs(),
|
|
139
157
|
},
|
|
140
158
|
};
|
|
159
|
+
|
|
160
|
+
// The workers of a session of an agent: `maxWorkers` of Vitest is GRILLHOUSE_TRAVAILLEURS
|
|
161
|
+
// (max(1, cores ÷ places), scripts/places-de-la-machine.mjs); without it (a heavy pass), Vitest's
|
|
162
|
+
// own default stands: every core.
|
|
163
|
+
function travailleurs() {
|
|
164
|
+
const n = travailleursDeLaSeance(process.env);
|
|
165
|
+
return n === null ? {} : { maxWorkers: n };
|
|
166
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// The delays of the sizes of test, in ms, on the model of Bazel's test-encyclopedia: small, medium,
|
|
2
|
+
// large. A module of its own, with no import: the configurations of Vitest (./base.mjs,
|
|
3
|
+
// ../vitest.nuit.config.mjs) are bundled by Vite and read only these numbers, while the
|
|
4
|
+
// classification that deduces a file's size (./delais.mjs) reads the guard of the sizes, a script.
|
|
5
|
+
|
|
6
|
+
/** The delay of each size, in ms (Bazel: small 60 s, medium 300 s, large 900 s). */
|
|
7
|
+
export const DELAIS_MS = { petit: 60000, moyen: 300000, grand: 900000 };
|
|
8
|
+
|
|
9
|
+
/** The delay of a night test, in ms: the large delay. */
|
|
10
|
+
export const DELAI_NUIT_MS = DELAIS_MS.grand;
|
|
11
|
+
|
|
12
|
+
/** The delay of a size as a line writes it: « petit, 60 s ». */
|
|
13
|
+
export const libelleDuDelai = taille => `${taille}, ${DELAIS_MS[taille] / 1000} s`;
|
|
@@ -60,7 +60,6 @@ import { existsSync, readFileSync, realpathSync } from 'node:fs';
|
|
|
60
60
|
import { createRequire } from 'node:module';
|
|
61
61
|
import path from 'node:path';
|
|
62
62
|
import { fileURLToPath } from 'node:url';
|
|
63
|
-
import { CHANGEMENTS } from '../../../services-du-noyau.mjs';
|
|
64
63
|
import { testsQuiLancent } from './lances.mjs';
|
|
65
64
|
|
|
66
65
|
// This directory, the frame's base configuration.
|
|
@@ -93,7 +92,9 @@ const sous = (f, dir) => {
|
|
|
93
92
|
export function lireChangements(chemin) {
|
|
94
93
|
const c = lireJson(chemin);
|
|
95
94
|
const liste = l => Array.isArray(l) && l.every(x => typeof x === 'string');
|
|
96
|
-
if (!c || typeof c.racine !== 'string' || !liste(c.fichiers) || !liste(c.supprimes))
|
|
95
|
+
if (!c || typeof c.racine !== 'string' || !liste(c.fichiers) || !liste(c.supprimes)) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
97
98
|
return c;
|
|
98
99
|
}
|
|
99
100
|
|
|
@@ -104,7 +105,9 @@ const DU_HAUT = '$TURBO_ROOT$/';
|
|
|
104
105
|
// present): the patterns, an empty list when it names none or does not read.
|
|
105
106
|
function entreesDuBuild(dir, noms) {
|
|
106
107
|
const f = noms.map(n => path.join(dir, n)).find(n => existsSync(n));
|
|
107
|
-
if (!f)
|
|
108
|
+
if (!f) {
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
108
111
|
try {
|
|
109
112
|
const { parse } = createRequire(import.meta.url)('jsonc-parser');
|
|
110
113
|
const inputs = parse(readFileSync(f, 'utf8'), [], { allowTrailingComma: true })?.tasks?.build
|
|
@@ -119,7 +122,9 @@ function entreesDuBuild(dir, noms) {
|
|
|
119
122
|
// absolute path <a>, which lies in it (6 above).
|
|
120
123
|
function construit(racine, d, a) {
|
|
121
124
|
const r = path.relative(d, a);
|
|
122
|
-
if (TEST.test(r))
|
|
125
|
+
if (TEST.test(r)) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
123
128
|
const motifs = entreesDuBuild(d, ['turbo.json']).flatMap(m =>
|
|
124
129
|
m === '$TURBO_EXTENDS$' ? entreesDuBuild(racine, ['turbo.json', 'turbo.jsonc']) : [m]
|
|
125
130
|
);
|
|
@@ -131,9 +136,13 @@ function construit(racine, d, a) {
|
|
|
131
136
|
(m.startsWith(DU_HAUT)
|
|
132
137
|
? couvre(path.relative(racine, a), m.slice(DU_HAUT.length))
|
|
133
138
|
: couvre(r, m));
|
|
134
|
-
if (motifs.some(m => m.startsWith('!') && lu(m.slice(1))))
|
|
139
|
+
if (motifs.some(m => m.startsWith('!') && lu(m.slice(1)))) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
135
142
|
const positifs = motifs.filter(m => !m.startsWith('!'));
|
|
136
|
-
if (positifs.length)
|
|
143
|
+
if (positifs.length) {
|
|
144
|
+
return positifs.some(lu);
|
|
145
|
+
}
|
|
137
146
|
return MODULE.test(r) && r.split(path.sep)[0] !== 'docs';
|
|
138
147
|
}
|
|
139
148
|
|
|
@@ -149,7 +158,9 @@ function dependances(racine, dossier) {
|
|
|
149
158
|
for (let ici = d; sous(ici, racine); ici = path.dirname(ici)) {
|
|
150
159
|
const lien = path.join(ici, 'node_modules', nom);
|
|
151
160
|
if (!existsSync(lien)) {
|
|
152
|
-
if (ici === racine)
|
|
161
|
+
if (ici === racine) {
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
153
164
|
continue;
|
|
154
165
|
}
|
|
155
166
|
let reel;
|
|
@@ -209,7 +220,9 @@ function paquetEntier(ch, dossier, test = {}) {
|
|
|
209
220
|
: sous(a, dossier) && !MODULE.test(f)
|
|
210
221
|
? 'un fichier qu’aucun module n’importe, qu’un test lit sans l’importer'
|
|
211
222
|
: null;
|
|
212
|
-
if (raison)
|
|
223
|
+
if (raison) {
|
|
224
|
+
return { raison, fichier: f };
|
|
225
|
+
}
|
|
213
226
|
}
|
|
214
227
|
return null;
|
|
215
228
|
}
|
|
@@ -27,7 +27,9 @@
|
|
|
27
27
|
// the plugin excludes the witnesses found under the configuration's directory
|
|
28
28
|
// (`fichiersTemoins`, node_modules, dist, .git, .turbo and .claude left out), with or without
|
|
29
29
|
// the variable.
|
|
30
|
-
// - A night test
|
|
30
|
+
// - A night test named is refused, named, and nothing plays: the night alone plays it
|
|
31
|
+
// (./tests-de-nuit.mjs).
|
|
32
|
+
// - A bench or a witness plays when its own file is named, as Bazel's target tagged
|
|
31
33
|
// `manual` builds when named: the day's exclusions lift for that file, the include of the
|
|
32
34
|
// configuration notwithstanding, and the measure of time of the base configuration applies, its
|
|
33
35
|
// duration reporter giving 75, « à repasser », to a measure that fails under load. A directory
|
|
@@ -43,13 +45,13 @@
|
|
|
43
45
|
// files played to those Vitest relates to them, the files named themselves kept, or leave every
|
|
44
46
|
// test when a change lies out of Vitest's graph.
|
|
45
47
|
//
|
|
46
|
-
// This module's top level uses Node alone: scripts/langages/typescript/tests.mjs reads its VARIABLE.
|
|
47
48
|
import { globSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
48
49
|
import path from 'node:path';
|
|
49
|
-
import { CHANGEMENTS } from '../../../services-du-noyau.mjs';
|
|
50
|
+
import { CHANGEMENTS, TESTS_CIBLES } from '../../../services-du-noyau.mjs';
|
|
50
51
|
import { lireChangements, restreindre } from './changements.mjs';
|
|
51
52
|
|
|
52
|
-
|
|
53
|
+
// The name of the variable is the core's (`TESTS_CIBLES`); this module reads it under its own name.
|
|
54
|
+
export const VARIABLE = TESTS_CIBLES;
|
|
53
55
|
// The day's exclusions, which the base configuration (./base.mjs) sets and the night plays
|
|
54
56
|
// (scripts/langages/typescript/vitest.nuit.config.mjs): the night tests, too long for the day, and the time budget
|
|
55
57
|
// benches, whose measures move with the load of the day.
|
|
@@ -58,8 +60,17 @@ export const BUDGET = '**/*.budget.{test,spec}.?(c|m)[jt]s?(x)';
|
|
|
58
60
|
export const HORS_DU_JOUR = [NUIT, BUDGET];
|
|
59
61
|
/** The variable that chooses the tests of a run of the night's configuration: `nuit` or `mesures`. */
|
|
60
62
|
export const NUIT_VARIABLE = 'GRILLHOUSE_TESTS_DE_NUIT';
|
|
61
|
-
// Whether
|
|
62
|
-
|
|
63
|
+
// Whether the file at <fichier> bears the name of <motif>, a globstar then a name: by the name of
|
|
64
|
+
// the file, since a globstar passes no directory whose name starts with a dot, and a ticket's copy
|
|
65
|
+
// lives under `.claude/worktrees/`.
|
|
66
|
+
const parSonNom = (fichier, motif) =>
|
|
67
|
+
path.matchesGlob(path.basename(fichier), motif.replace(/^\*\*\//, ''));
|
|
68
|
+
/** Whether the file at <fichier> is a night test, by its name: the one rule of the frame. */
|
|
69
|
+
export const estUnTestDeNuit = fichier => parSonNom(fichier, NUIT);
|
|
70
|
+
/** Whether the file at <fichier> is a time budget bench, by its name. */
|
|
71
|
+
export const estUnBanc = fichier => parSonNom(fichier, BUDGET);
|
|
72
|
+
/** Whether the file at <fichier> is a night test or a time budget bench, by its name. */
|
|
73
|
+
export const deNuitOuBanc = fichier => HORS_DU_JOUR.some(p => parSonNom(fichier, p));
|
|
63
74
|
// Vitest's default `include` (its configDefaults).
|
|
64
75
|
const INCLUDE = ['**/*.{test,spec}.?(c|m)[jt]s?(x)'];
|
|
65
76
|
// The mark of a time witness: the import of `mesurerAuRepos`, on a line of its own, from the
|
|
@@ -78,11 +89,10 @@ const lireTexte = f => {
|
|
|
78
89
|
|
|
79
90
|
/**
|
|
80
91
|
* Whether the test file at <fichier> is out of the day: a night test, a time budget bench or a
|
|
81
|
-
* time witness.
|
|
92
|
+
* time witness; the night and the bench by its name (`deNuitOuBanc`).
|
|
82
93
|
* @param {string} fichier the path of the file
|
|
83
94
|
*/
|
|
84
|
-
export const estHorsDuJour = fichier =>
|
|
85
|
-
HORS_DU_JOUR.some(p => path.matchesGlob(fichier, p)) || estTemoin(lireTexte(fichier));
|
|
95
|
+
export const estHorsDuJour = fichier => deNuitOuBanc(fichier) || estTemoin(lireTexte(fichier));
|
|
86
96
|
// The directories a search of the witnesses leaves out.
|
|
87
97
|
const HORS_TEMOINS = new Set(['node_modules', 'dist', '.git', '.turbo', '.claude']);
|
|
88
98
|
|
|
@@ -97,7 +107,7 @@ export function fichiersTemoins(dir, include = INCLUDE) {
|
|
|
97
107
|
)
|
|
98
108
|
),
|
|
99
109
|
]
|
|
100
|
-
.filter(f => !
|
|
110
|
+
.filter(f => !deNuitOuBanc(f) && estTemoin(lire(f)))
|
|
101
111
|
.sort();
|
|
102
112
|
}
|
|
103
113
|
// The directories a walk under a named directory leaves out, whose files no test configuration
|
|
@@ -182,25 +192,37 @@ async function cibler(config, test, valeur, temoins) {
|
|
|
182
192
|
const dir = path.resolve(config.root ?? process.cwd(), test.dir ?? '');
|
|
183
193
|
const include = test.include ?? INCLUDE;
|
|
184
194
|
const chemins = filter.map(f => path.resolve(f.replace(/[\\/]+$/, '')));
|
|
195
|
+
const relatif = f => path.relative(dir, f).split(path.sep).join('/');
|
|
185
196
|
// The files named themselves, not through a directory.
|
|
186
197
|
const seuls = new Set(chemins.filter(f => fichiers(f)[0] === f));
|
|
198
|
+
// A night test plays at night alone (./tests-de-nuit.mjs): a targeted run refuses it, named.
|
|
199
|
+
const deNuit = [...seuls].filter(estUnTestDeNuit);
|
|
200
|
+
if (deNuit.length) {
|
|
201
|
+
throw new Error(
|
|
202
|
+
deNuit
|
|
203
|
+
.map(
|
|
204
|
+
f =>
|
|
205
|
+
`⛔ ${relatif(f)} : un test de nuit se joue la nuit seulement (npx grillhouse nuit le joue)`
|
|
206
|
+
)
|
|
207
|
+
.join('\n')
|
|
208
|
+
);
|
|
209
|
+
}
|
|
187
210
|
nommes = [...seuls];
|
|
188
|
-
const relatif = f => path.relative(dir, f).split(path.sep).join('/');
|
|
189
211
|
const joues = [...new Set(chemins.flatMap(fichiers))]
|
|
190
212
|
.filter(f => {
|
|
191
213
|
const r = relatif(f);
|
|
192
214
|
if (r.startsWith('../')) {
|
|
193
215
|
return false;
|
|
194
216
|
}
|
|
195
|
-
return
|
|
217
|
+
return deNuitOuBanc(r) || temoins.has(r.replace(SPECIAUX, '\\$&'))
|
|
196
218
|
? seuls.has(f)
|
|
197
219
|
: include.some(p => path.matchesGlob(r, p));
|
|
198
220
|
})
|
|
199
221
|
.map(relatif)
|
|
200
222
|
.sort();
|
|
201
|
-
// A bench
|
|
223
|
+
// A bench named itself plays: the day's exclusions lift, and the
|
|
202
224
|
// files under a directory named stay out by the filter above (a witness, by the plugin).
|
|
203
|
-
if (joues.some(
|
|
225
|
+
if (joues.some(deNuitOuBanc) && Array.isArray(test.exclude)) {
|
|
204
226
|
test.exclude = test.exclude.filter(p => !HORS_DU_JOUR.includes(p));
|
|
205
227
|
}
|
|
206
228
|
// No file named: a pattern that matches none, Vitest's « No test files found ».
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// The delay of each size of test, on the model of Bazel's test-encyclopedia (a delay per size; a
|
|
2
|
+
// test past it is killed) and of Vitest's `slowTestThreshold`.
|
|
3
|
+
//
|
|
4
|
+
// - The delay of a day test file is deduced from its size by the classification of the guard of
|
|
5
|
+
// the sizes (`classer`, ../tailles-des-tests.mjs), the one address of the rule; the three delays
|
|
6
|
+
// are written once, in ./bornes.mjs.
|
|
7
|
+
// - A file out of the day (a night test, a bench, a time witness) that a targeted run plays has the
|
|
8
|
+
// large delay, whatever its text reads.
|
|
9
|
+
// - A setup file of the base configuration applies the delay of its file to each test file
|
|
10
|
+
// (./delais.setup.mjs).
|
|
11
|
+
import { existsSync } from 'node:fs';
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
import { lesMatieres, classer } from '../tailles-des-tests.mjs';
|
|
14
|
+
import { DELAI_NUIT_MS, DELAIS_MS, libelleDuDelai } from './bornes.mjs';
|
|
15
|
+
import { estHorsDuJour } from './cibles.mjs';
|
|
16
|
+
import { lireLeDisque } from './lances.mjs';
|
|
17
|
+
|
|
18
|
+
export { DELAI_NUIT_MS, DELAIS_MS, libelleDuDelai };
|
|
19
|
+
|
|
20
|
+
const memoMatieres = new Map();
|
|
21
|
+
const matieresDe = racine => {
|
|
22
|
+
if (!memoMatieres.has(racine)) {
|
|
23
|
+
memoMatieres.set(racine, lesMatieres(racine));
|
|
24
|
+
}
|
|
25
|
+
return memoMatieres.get(racine);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The delay of the test file <fichier> (absolute), read by <lire> in the repository at <racine>:
|
|
30
|
+
* `{ taille, delai }`, `delai` in ms.
|
|
31
|
+
*/
|
|
32
|
+
export function delaisDuFichier(fichier, { lire, racine }) {
|
|
33
|
+
const taille = estHorsDuJour(fichier)
|
|
34
|
+
? 'grand'
|
|
35
|
+
: classer(fichier, lire, racine, matieresDe(racine)).taille;
|
|
36
|
+
return { taille, delai: DELAIS_MS[taille] };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** The settings Vitest applies to the test file <fichier>: its delay for a test and a hook. */
|
|
40
|
+
export function reglagesDuFichier(fichier, options) {
|
|
41
|
+
const { delai } = delaisDuFichier(fichier, options);
|
|
42
|
+
return { testTimeout: delai, hookTimeout: delai };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** The root of the repository that holds <fichier>: the first directory above with a `.git`. */
|
|
46
|
+
export function racineDuDepot(fichier) {
|
|
47
|
+
for (let d = path.dirname(fichier); ; d = path.dirname(d)) {
|
|
48
|
+
if (existsSync(path.join(d, '.git'))) {
|
|
49
|
+
return d;
|
|
50
|
+
}
|
|
51
|
+
if (path.dirname(d) === d) {
|
|
52
|
+
return process.cwd();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** The delay of <fichier> as the disk of its repository gives it. */
|
|
58
|
+
export function delaisSurLeDisque(fichier) {
|
|
59
|
+
return delaisDuFichier(fichier, { lire: lireLeDisque, racine: racineDuDepot(fichier) });
|
|
60
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// A setup file of the base configuration: a test file has the delay of its size, as Bazel gives
|
|
2
|
+
// each test the delay of its `size`. It reads the size of the file it sets up (./delais.mjs, by the
|
|
3
|
+
// classification of the guard of the sizes) and gives Vitest its delay for a test and a hook.
|
|
4
|
+
import { vi } from 'vitest';
|
|
5
|
+
import { delaisSurLeDisque } from './delais.mjs';
|
|
6
|
+
|
|
7
|
+
const fichier = globalThis.__vitest_worker__?.filepath;
|
|
8
|
+
if (fichier) {
|
|
9
|
+
const { delai } = delaisSurLeDisque(fichier);
|
|
10
|
+
vi.setConfig({ testTimeout: delai, hookTimeout: delai });
|
|
11
|
+
}
|