@roomi-fields/grillhouse 0.24.15 → 0.25.1
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/bin/grillhouse.mjs +40 -12
- package/cadre/templates/cargo/.config/nextest.toml +8 -0
- package/cadre/templates/cargo/deny.toml +41 -0
- package/cadre/templates/cargo/package.json +15 -0
- package/cadre/templates/cargo/rust-toolchain.toml +6 -0
- package/cadre/templates/projet/package.json +5 -1
- package/cadre/templates/turbo/paquets.json +1 -1
- package/cadre/templates/turbo/sans-paquets.json +1 -1
- package/charte.md +16 -0
- package/docs/ARCHITECTURE.md +160 -56
- package/docs/CADRE.md +47 -0
- package/docs/INTERFACE.md +176 -0
- package/package.json +66 -13
- package/scripts/arbitrages.mjs +23 -0
- package/scripts/avancement.mjs +15 -29
- package/scripts/circuit.mjs +89 -97
- package/scripts/commande-du-langage.mjs +56 -0
- package/scripts/composants-affectes.mjs +47 -170
- package/scripts/conformite.d.ts +27 -0
- package/scripts/conformite.mjs +226 -0
- package/scripts/demon.mjs +1 -1
- package/scripts/dernier-vert.mjs +11 -9
- package/scripts/droits.mjs +27 -21
- package/scripts/enveloppe/enveloppe.mjs +206 -64
- package/scripts/enveloppe/lancer.sh +20 -91
- package/scripts/enveloppe/paquets-du-plan.mjs +24 -2
- package/scripts/etapes.mjs +2 -2
- package/scripts/gardes-du-cadre.mjs +12 -18
- package/scripts/grillhouse-maj.mjs +246 -389
- package/scripts/init.mjs +2 -1
- package/scripts/integration/file.mjs +3 -3
- package/scripts/integration/integrer.mjs +13 -10
- package/scripts/integration/rejeu.mjs +36 -7
- package/scripts/jointure.d.ts +304 -0
- package/scripts/langages/cargo/binaires.json +4 -0
- package/scripts/langages/cargo/binaires.mjs +60 -0
- package/scripts/langages/cargo/clippy.mjs +103 -0
- package/scripts/langages/cargo/commandes.mjs +378 -0
- package/scripts/langages/cargo/composants.mjs +191 -0
- package/scripts/langages/cargo/elements-du-lot.mjs +139 -0
- package/scripts/langages/cargo/exemples.mjs +357 -0
- package/scripts/langages/cargo/frontieres.mjs +84 -0
- package/scripts/langages/cargo/index-interfaces.mjs +138 -0
- package/scripts/langages/cargo/index.mjs +115 -0
- package/scripts/langages/cargo/mise-a-jour.mjs +93 -0
- package/scripts/langages/cargo/nextest.toml +5 -0
- package/scripts/langages/cargo/touches.mjs +93 -0
- package/scripts/langages/cargo/verdict.mjs +85 -0
- package/scripts/langages/typescript/chemins-des-tests.mjs +68 -0
- package/scripts/{code-mort.mjs → langages/typescript/code-mort.mjs} +5 -5
- package/scripts/langages/typescript/composants.mjs +64 -0
- package/scripts/{consommateurs-arbitres.mjs → langages/typescript/consommateurs-arbitres.mjs} +6 -24
- package/scripts/{consommateurs.mjs → langages/typescript/consommateurs.mjs} +13 -71
- package/scripts/langages/typescript/construire.mjs +176 -0
- package/scripts/{elements-du-lot.mjs → langages/typescript/elements-du-lot.mjs} +2 -2
- package/scripts/langages/typescript/exemples.mjs +289 -0
- package/scripts/{frontieres.mjs → langages/typescript/frontieres.mjs} +3 -5
- package/scripts/{index-interfaces.mjs → langages/typescript/index-interfaces.mjs} +3 -3
- package/scripts/langages/typescript/index.mjs +335 -0
- package/scripts/{interfaces-contre-code.mjs → langages/typescript/interfaces-contre-code.mjs} +2 -2
- package/scripts/langages/typescript/lecteurs.mjs +179 -0
- package/scripts/{migrations → langages/typescript/migrations}/0.23.0-config-vitest.mjs +14 -29
- package/scripts/{migrations → langages/typescript/migrations}/0.24.4-noms-declares-inutilises.mjs +2 -2
- package/scripts/{migrations → langages/typescript/migrations}/0.24.6-lignes-mal-formees.mjs +2 -2
- package/scripts/{migrations → langages/typescript/migrations}/0.24.7-matiere-dans-les-tests.mjs +2 -2
- package/scripts/langages/typescript/migrations/0.25.0-chemins-des-tests.mjs +27 -0
- package/scripts/langages/typescript/migrations/0.25.0-tailles-des-tests.mjs +31 -0
- package/scripts/langages/typescript/mise-a-jour.mjs +320 -0
- package/scripts/{references-par-les-types.mjs → langages/typescript/references-par-les-types.mjs} +3 -3
- package/scripts/langages/typescript/regle-des-tests.mjs +39 -0
- package/scripts/{resumes.mjs → langages/typescript/resumes.mjs} +4 -4
- package/scripts/langages/typescript/script-des-tests.mjs +6 -0
- package/scripts/langages/typescript/tailles-des-tests.mjs +219 -0
- package/scripts/langages/typescript/tests-de-nuit.mjs +57 -0
- package/scripts/{tests.mjs → langages/typescript/tests.mjs} +41 -32
- package/scripts/{turbo-des-paquets.mjs → langages/typescript/turbo-des-paquets.mjs} +49 -23
- package/scripts/langages/typescript/verdict.mjs +105 -0
- package/scripts/{verifier.mjs → langages/typescript/verifier.mjs} +53 -34
- package/scripts/{vitest-config → langages/typescript/vitest-config}/avancement.reporter.mjs +10 -2
- package/scripts/{vitest-config → langages/typescript/vitest-config}/base.mjs +63 -9
- package/scripts/{vitest-config → langages/typescript/vitest-config}/changements.mjs +18 -11
- package/scripts/{vitest-config → langages/typescript/vitest-config}/cibles.mjs +7 -6
- package/scripts/langages/typescript/vitest-config/duree.reporter.d.ts +10 -0
- package/scripts/{vitest-config → langages/typescript/vitest-config}/duree.reporter.mjs +10 -3
- package/scripts/langages/typescript/vitest-config/lances.mjs +473 -0
- package/scripts/{vitest-config → langages/typescript/vitest-config}/mesure.setup.mjs +1 -1
- package/scripts/{vitest-config → langages/typescript/vitest-config}/resultats.mjs +5 -5
- package/scripts/{vitest-config → langages/typescript/vitest-config}/resultats.setup.mjs +4 -3
- package/scripts/{vitest.nuit.config.mjs → langages/typescript/vitest.nuit.config.mjs} +2 -2
- package/scripts/langages.mjs +85 -0
- package/scripts/{vitest-config → mesure}/avancement.mjs +4 -13
- package/scripts/{vitest-config → mesure}/base-de-passe.mjs +70 -33
- package/scripts/{vitest-config → mesure}/pression.mjs +5 -6
- package/scripts/migrations/0.23.2-copies-du-cadre.mjs +29 -6
- package/scripts/migrations/0.24.0-circuit-simplifie.mjs +13 -6
- package/scripts/migrations/0.25.0-script-des-tests.mjs +92 -0
- package/scripts/migrations.mjs +17 -13
- package/scripts/nuit.sh +59 -63
- package/scripts/paquets.d.ts +5 -0
- package/scripts/paquets.mjs +24 -2
- package/scripts/resultats.mjs +8 -82
- package/scripts/services-du-noyau.mjs +30 -0
- package/scripts/session-start.sh +17 -9
- package/scripts/sources.mjs +35 -13
- package/scripts/sous-commandes.mjs +57 -17
- package/scripts/superviseur.mjs +1 -1
- package/scripts/tableau.mjs +1 -1
- package/scripts/un-commit-par-ticket.mjs +48 -14
- package/scripts/verrou-de-fichier.mjs +1 -1
- package/scripts/verrou-de-machine.mjs +4 -4
- package/scripts/verrous/verrou.mjs +28 -37
- package/skills/developpeur/SKILL.md +2 -2
- package/skills/explorateur/SKILL.md +13 -5
- package/skills/grill/SKILL.md +2 -2
- package/skills/pitmaster/references/cadre.md +1 -1
- package/skills/pitmaster/references/consigne-agent.md +10 -3
- package/skills/redacteur/references/documents-d-un-composant.md +4 -4
- package/skills/relecteur/SKILL.md +4 -1
- package/skills/testwriter/SKILL.md +20 -6
- /package/scripts/{consommateurs.d.ts → langages/typescript/consommateurs.d.ts} +0 -0
- /package/scripts/{vitest-config → langages/typescript/vitest-config}/base.d.ts +0 -0
- /package/scripts/{vitest-config → langages/typescript/vitest-config}/machine.setup.mjs +0 -0
- /package/scripts/{vitest-config → langages/typescript/vitest-config}/mesure.d.ts +0 -0
- /package/scripts/{vitest-config → langages/typescript/vitest-config}/mesure.mjs +0 -0
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// `vitest --changed` and `jest --onlyChanged` do: the tree of the last pass green on every
|
|
11
11
|
// package, kept per branch (main's for a copy that has none yet). When it counts (its commit an ancestor of HEAD), each package
|
|
12
12
|
// Turborepo plays again plays the tests Vitest relates to the files changed since it, or all
|
|
13
|
-
// its tests when a change lies out of Vitest's graph (scripts/vitest-config/changements.mjs);
|
|
13
|
+
// its tests when a change lies out of Vitest's graph (scripts/langages/typescript/vitest-config/changements.mjs);
|
|
14
14
|
// a package whose inputs did not move replays from Turborepo's cache, the guards play whole,
|
|
15
15
|
// and so do the builds. The changes reach Vitest in a variable no hash counts
|
|
16
16
|
// (`GRILLHOUSE_CHANGEMENTS`). Without a last green that counts, the pass is complete. The
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
// second rank: it waits while a project's measure waits too.
|
|
28
28
|
// - Turborepo plays the build, then the guards (the frame's, `grillhouse:gardes`, and the
|
|
29
29
|
// project's own, its root script `gardes`), the typing of each package (`typecheck`, its
|
|
30
|
-
// sources and its tests, cached per package: scripts/turbo-des-paquets.mjs) and the tests
|
|
31
|
-
// (`test:
|
|
32
|
-
// `turbo run grillhouse:gardes gardes typecheck test:
|
|
30
|
+
// sources and its tests, cached per package: scripts/langages/typescript/turbo-des-paquets.mjs) and the tests
|
|
31
|
+
// (`test:unit`) beside each other:
|
|
32
|
+
// `turbo run grillhouse:gardes gardes typecheck test:unit --continue=dependencies-successful
|
|
33
33
|
// --concurrency=<n> --summarize`, each argument given after it. A red does not stop the pass:
|
|
34
34
|
// every task whose prerequisites passed plays, and each red is named. <n>, the tasks side by
|
|
35
35
|
// side, is half the cores of the machine, one at least (`concurrence`): each task of tests is
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
// build by the machine; a `--concurrency` among the arguments replaces it.
|
|
38
38
|
// - The time witnesses play alone, as Bazel plays a test tagged `exclusive`: the pass above leaves
|
|
39
39
|
// them out, then a pass of their own plays them, one task at a time, one file at a time, nothing
|
|
40
|
-
// beside them: `turbo run test:
|
|
40
|
+
// beside them: `turbo run test:unit --filter=<package>… --continue=dependencies-successful
|
|
41
41
|
// --concurrency=1 --summarize`, for each package that holds one (a test file that imports
|
|
42
|
-
// `mesurerAuRepos`, `fichiersTemoins` of scripts/vitest-config/cibles.mjs, which receives the
|
|
42
|
+
// `mesurerAuRepos`, `fichiersTemoins` of scripts/langages/typescript/vitest-config/cibles.mjs, which receives the
|
|
43
43
|
// choice in the variable of the tests, `GRILLHOUSE_TESTS`: `temoins: 'hors'`, then `'seuls'`).
|
|
44
44
|
// A repository without a witness plays no such pass. So a witness is measured under no load of
|
|
45
45
|
// its own pass: a load it meets comes from elsewhere on the machine.
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
// wait for, a summary that does not read while Turborepo failed: red, code 1, each task named, a
|
|
60
60
|
// task of the witnesses' pass with « (témoins de temps) ».
|
|
61
61
|
// - A task at 75 (« à repasser »: every failure of its tests depended on a duration and one took
|
|
62
|
-
// place under load, scripts/vitest-config/duree.reporter.mjs) is played again alone, once the CPU
|
|
63
|
-
// pressure is back under the threshold (scripts/
|
|
62
|
+
// place under load, scripts/langages/typescript/vitest-config/duree.reporter.mjs) is played again alone, once the CPU
|
|
63
|
+
// pressure is back under the threshold (scripts/mesure/pression.mjs; one line per 30 s at
|
|
64
64
|
// most while it waits, with the pressure), one task after the other, in the choice of its run
|
|
65
65
|
// (a task of the witnesses' pass plays its witnesses alone again):
|
|
66
66
|
// `turbo run <task> --filter=<package>`, the arguments given after it, with what it depends on,
|
|
@@ -77,47 +77,61 @@
|
|
|
77
77
|
// plan of each run that plays tests (`turbo run … --dry=json`) names their tasks and counts done
|
|
78
78
|
// the files of those Turborepo replays from its cache.
|
|
79
79
|
// - The red tasks: while the variable `GRILLHOUSE_ROUGES` (`ROUGES`) names a file, the pass writes
|
|
80
|
-
// there, one Turborepo task id per line (`<package>#<task>`, `//#<task>` for the root),
|
|
80
|
+
// there, one Turborepo task id per line (`<package>#<task>`, `//#<task>` for the root), then a
|
|
81
|
+
// tab and the command that replays it alone (`npx turbo run <task> --filter=<package>`), each task
|
|
81
82
|
// red on its own exit code, a task red at rest included, once each; a task à repasser (75) is
|
|
82
83
|
// none of them, nor a task that did not play (its prerequisite red is). Green or à repasser, the
|
|
83
84
|
// file is empty. The night reads it for its bisect commands (scripts/nuit.sh), with no second
|
|
84
85
|
// reading of the summaries.
|
|
85
|
-
// - The pass has a base of its own (scripts/
|
|
86
|
+
// - The pass has a base of its own (scripts/mesure/base-de-passe.mjs), in the temporary
|
|
86
87
|
// directory of its environment, which it sweeps first of the bases a killed pass left: every
|
|
87
|
-
// run of Turborepo gets it in TMPDIR,
|
|
88
|
-
// task (scripts/turbo-des-paquets.mjs), and the pass
|
|
88
|
+
// run of Turborepo gets it in TMPDIR, TMP and TEMP, the root's `globalPassThroughEnv` passing
|
|
89
|
+
// TMPDIR on to every task (scripts/langages/typescript/turbo-des-paquets.mjs), and the pass
|
|
90
|
+
// removes it at its end, green, red or interrupted (SIGINT, SIGTERM, SIGHUP).
|
|
89
91
|
// - Every run plays without the paths of a targeted run's tests: the variable `GRILLHOUSE_TESTS`
|
|
90
|
-
// (scripts/vitest-config/cibles.mjs) carries only the choice of the witnesses (and `rejouer` for
|
|
92
|
+
// (scripts/langages/typescript/vitest-config/cibles.mjs) carries only the choice of the witnesses (and `rejouer` for
|
|
91
93
|
// a complete pass).
|
|
92
94
|
import { spawnSync } from 'node:child_process';
|
|
93
95
|
import { existsSync, readdirSync, readFileSync, rmdirSync, rmSync, writeFileSync } from 'node:fs';
|
|
94
96
|
import { availableParallelism, tmpdir } from 'node:os';
|
|
95
97
|
import path from 'node:path';
|
|
96
98
|
import { pathToFileURL } from 'node:url';
|
|
97
|
-
import { ecrireLaMesure, garderLeTotal, ouvrirAvancement, planifier } from './avancement.mjs';
|
|
98
|
-
import { paquetsDeLEnveloppe } from './enveloppe/paquets-du-plan.mjs';
|
|
99
|
-
import { paquets } from './paquets.mjs';
|
|
100
|
-
import { TYPAGE } from './turbo-des-paquets.mjs';
|
|
101
|
-
import { AttenteDeLaMachine, avecLaMachine } from './verrou-de-machine.mjs';
|
|
102
99
|
import {
|
|
103
100
|
A_REPASSER,
|
|
104
101
|
attendreLeRepos,
|
|
102
|
+
AttenteDeLaMachine,
|
|
103
|
+
AVANCEMENT,
|
|
104
|
+
avecLaMachine,
|
|
105
105
|
BORNE_ATTENTE_MS,
|
|
106
|
+
CHANGEMENTS,
|
|
107
|
+
ecrireLaMesure,
|
|
108
|
+
garderLeTotal,
|
|
109
|
+
garderLeVert,
|
|
106
110
|
lirePression,
|
|
107
|
-
|
|
108
|
-
|
|
111
|
+
mesure,
|
|
112
|
+
ouvrirAvancement,
|
|
113
|
+
ouvrirBase,
|
|
114
|
+
paquetsDeLEnveloppe,
|
|
115
|
+
retirerALInterruption,
|
|
116
|
+
} from '../../services-du-noyau.mjs';
|
|
117
|
+
import { paquets, TYPAGE } from '../../paquets.mjs';
|
|
118
|
+
import { planifier } from './turbo-des-paquets.mjs';
|
|
119
|
+
import { SCRIPT_DES_TESTS } from './script-des-tests.mjs';
|
|
120
|
+
import { garderLesResumes } from './verdict.mjs';
|
|
109
121
|
import { fichiersTemoins, VARIABLE as TESTS_CIBLES } from './vitest-config/cibles.mjs';
|
|
110
|
-
import { AVANCEMENT } from './vitest-config/avancement.mjs';
|
|
111
|
-
import { CHANGEMENTS } from './vitest-config/changements.mjs';
|
|
112
|
-
import { garderLeVert, mesure } from './dernier-vert.mjs';
|
|
113
|
-
import { ouvrirBase } from './vitest-config/base-de-passe.mjs';
|
|
114
122
|
|
|
115
123
|
const GARDES = ['grillhouse:gardes', 'gardes'];
|
|
116
|
-
const TACHES = [...GARDES, TYPAGE,
|
|
124
|
+
const TACHES = [...GARDES, TYPAGE, SCRIPT_DES_TESTS];
|
|
117
125
|
const TEMOINS = ' (témoins de temps)';
|
|
118
126
|
const CONCURRENCE = /^--concurrency(?:=|$)/;
|
|
119
127
|
// The variable that names the file of the red tasks, which the night reads.
|
|
120
128
|
const ROUGES = 'GRILLHOUSE_ROUGES';
|
|
129
|
+
// The command that replays the task <id> (`<package>#<task>`) alone, Turborepo's hash replaying
|
|
130
|
+
// from its cache what did not change.
|
|
131
|
+
const rejeu = id => {
|
|
132
|
+
const i = id.indexOf('#');
|
|
133
|
+
return `npx turbo run ${id.slice(i + 1)} --filter=${id.slice(0, i)}`;
|
|
134
|
+
};
|
|
121
135
|
|
|
122
136
|
const lister = dossier => (existsSync(dossier) ? readdirSync(dossier) : []);
|
|
123
137
|
|
|
@@ -169,7 +183,7 @@ function filtresDesTemoins(racine) {
|
|
|
169
183
|
const liste = paquets(racine);
|
|
170
184
|
if (liste.length === 0) return fichiersTemoins(racine).length ? [] : null;
|
|
171
185
|
const noms = liste
|
|
172
|
-
.filter(p => !p.hors && p.pkg.scripts?.[
|
|
186
|
+
.filter(p => !p.hors && p.pkg.scripts?.[SCRIPT_DES_TESTS])
|
|
173
187
|
.filter(p => fichiersTemoins(path.resolve(racine, p.dossier)).length > 0)
|
|
174
188
|
.map(p => p.pkg.name);
|
|
175
189
|
return noms.length ? noms.map(n => `--filter=${n}`) : null;
|
|
@@ -192,6 +206,7 @@ export function verifier({
|
|
|
192
206
|
// The base of the pass, in the temporary directory of <env>: every task writes in it (TMPDIR,
|
|
193
207
|
// which Turborepo passes on), and it goes at the end of the pass.
|
|
194
208
|
const base = ouvrirBase('verification', { dans: env.TMPDIR || tmpdir() });
|
|
209
|
+
const lacher = retirerALInterruption(base.fermer);
|
|
195
210
|
try {
|
|
196
211
|
return avecLaMachine(
|
|
197
212
|
envMachine => {
|
|
@@ -216,7 +231,7 @@ export function verifier({
|
|
|
216
231
|
return passe({
|
|
217
232
|
racine,
|
|
218
233
|
demandes,
|
|
219
|
-
env: { ...envMachine, [AVANCEMENT]: dossier,
|
|
234
|
+
env: { ...envMachine, [AVANCEMENT]: dossier, ...base.env },
|
|
220
235
|
borneMs,
|
|
221
236
|
pasMs,
|
|
222
237
|
dire,
|
|
@@ -237,6 +252,7 @@ export function verifier({
|
|
|
237
252
|
dire(e.message);
|
|
238
253
|
return e.code;
|
|
239
254
|
} finally {
|
|
255
|
+
lacher();
|
|
240
256
|
base.fermer();
|
|
241
257
|
}
|
|
242
258
|
}
|
|
@@ -254,19 +270,21 @@ function nomDuDepot(racine) {
|
|
|
254
270
|
return path.basename(r.status === 0 ? path.dirname(r.stdout.trim()) : path.resolve(racine));
|
|
255
271
|
}
|
|
256
272
|
|
|
257
|
-
// Whether a package of <racine>, or its root, plays tests (a script `test:
|
|
258
|
-
function
|
|
273
|
+
// Whether a package of <racine>, or its root, plays tests (a script `test:unit`).
|
|
274
|
+
function depotAvecTests(racine) {
|
|
259
275
|
const liste = paquets(racine);
|
|
260
276
|
if (liste.length === 0) {
|
|
261
277
|
try {
|
|
262
278
|
return Boolean(
|
|
263
|
-
JSON.parse(readFileSync(path.join(racine, 'package.json'), 'utf8')).scripts?.[
|
|
279
|
+
JSON.parse(readFileSync(path.join(racine, 'package.json'), 'utf8')).scripts?.[
|
|
280
|
+
SCRIPT_DES_TESTS
|
|
281
|
+
]
|
|
264
282
|
);
|
|
265
283
|
} catch {
|
|
266
284
|
return false;
|
|
267
285
|
}
|
|
268
286
|
}
|
|
269
|
-
return liste.some(p => !p.hors && p.pkg.scripts?.[
|
|
287
|
+
return liste.some(p => !p.hors && p.pkg.scripts?.[SCRIPT_DES_TESTS]);
|
|
270
288
|
}
|
|
271
289
|
|
|
272
290
|
function passe({ racine, demandes, env, borneMs, pasMs, dire, coeurs }) {
|
|
@@ -292,7 +310,8 @@ function passe({ racine, demandes, env, borneMs, pasMs, dire, coeurs }) {
|
|
|
292
310
|
coeurs,
|
|
293
311
|
taches,
|
|
294
312
|
});
|
|
295
|
-
if (env[ROUGES])
|
|
313
|
+
if (env[ROUGES])
|
|
314
|
+
writeFileSync(env[ROUGES], [...taches].map(t => `${t}\t${rejeu(t)}\n`).join(''));
|
|
296
315
|
// A pass green on every package keeps its tree as the last green.
|
|
297
316
|
if (code === 0 && m?.etat && filtresDeLaPasse.length === 0) garderLeVert(m.etat);
|
|
298
317
|
return code;
|
|
@@ -378,7 +397,7 @@ function jouerLaPasse({
|
|
|
378
397
|
if (filtres) {
|
|
379
398
|
lancements.push({
|
|
380
399
|
a: [
|
|
381
|
-
|
|
400
|
+
SCRIPT_DES_TESTS,
|
|
382
401
|
...filtres,
|
|
383
402
|
'--continue=dependencies-successful',
|
|
384
403
|
'--concurrency=1',
|
|
@@ -389,7 +408,7 @@ function jouerLaPasse({
|
|
|
389
408
|
});
|
|
390
409
|
}
|
|
391
410
|
// The plan of each run that plays tests, before the first: the progress knows all its tasks.
|
|
392
|
-
if (!gardesSeules &&
|
|
411
|
+
if (!gardesSeules && depotAvecTests(racine)) {
|
|
393
412
|
for (const { a, e } of lancements) planifier(env[AVANCEMENT], { racine, args: a, env: e });
|
|
394
413
|
}
|
|
395
414
|
const passes = [];
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
// The reporter of progress of the base configuration, while the variable GRILLHOUSE_AVANCEMENT
|
|
2
|
-
// names the progress directory of a pass (
|
|
2
|
+
// names the progress directory of a pass (scripts/mesure/avancement.mjs): it writes the record of its task
|
|
3
3
|
// once Vitest knows the files it plays (their number, the files planned), then at each test file
|
|
4
4
|
// done, then at the end of the run, every file done. The name of the record is made of the package
|
|
5
5
|
// directory it runs in and its process; it carries the hash of its Turborepo task (TURBO_HASH), by
|
|
6
6
|
// which the pass knows it again in Turborepo's cache (scripts/avancement.mjs).
|
|
7
|
-
import {
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
import { AVANCEMENT, ecrireTache } from '../../../services-du-noyau.mjs';
|
|
9
|
+
|
|
10
|
+
// The reporter of progress under <env>'s progress directory, as Vitest's `reporters` take it; an
|
|
11
|
+
// empty list without the variable.
|
|
12
|
+
export function rapportAvancement(env = process.env) {
|
|
13
|
+
if (!env[AVANCEMENT]) return [];
|
|
14
|
+
return [fileURLToPath(import.meta.url)];
|
|
15
|
+
}
|
|
8
16
|
|
|
9
17
|
const FINIS = new Set(['pass', 'fail', 'skip', 'todo']);
|
|
10
18
|
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
// - The exclusions of the day: a night test (`*.nuit.test.*`, `*.nuit.spec.*`) is too long for the
|
|
14
14
|
// day, and the measures of a time budget bench (`*.budget.test.*`, `*.budget.spec.*`) move with
|
|
15
15
|
// the load of the day: `npm test`, `npm run verifier` and the integration leave both out, and
|
|
16
|
-
// the night plays them (scripts/nuit.sh, scripts/vitest.nuit.config.mjs); a targeted run that
|
|
16
|
+
// the night plays them (scripts/nuit.sh, scripts/langages/typescript/vitest.nuit.config.mjs); a targeted run that
|
|
17
17
|
// names the file of one itself plays it, under the measure of time below (./cibles.mjs, where
|
|
18
18
|
// the patterns live). `mergeConfig` adds the exclusions of a configuration that extends this one
|
|
19
19
|
// to these.
|
|
20
20
|
// - A run that plays no test fails, as Vitest's default has it (`passWithNoTests` unset): a
|
|
21
|
-
// targeted run (`npm test -- <paths>`, scripts/tests.mjs) plays each path in its package only,
|
|
21
|
+
// targeted run (`npm test -- <paths>`, scripts/langages/typescript/tests.mjs) plays each path in its package only,
|
|
22
22
|
// and a path that names no test is a mistake, never a green.
|
|
23
23
|
// - The tests a targeted run names arrive in the variable `GRILLHOUSE_TESTS`, which a plugin
|
|
24
24
|
// reads once the configuration is merged and turns into the files played (./cibles.mjs); without
|
|
@@ -42,28 +42,82 @@
|
|
|
42
42
|
// its own, so that a `npm run verifier` a test plays in a repository of trial neither waits for
|
|
43
43
|
// the lock of the machine nor holds it (./machine.setup.mjs, scripts/verrou-de-machine.mjs).
|
|
44
44
|
// - The time witnesses play alone in `npm run verifier`: the plugin below leaves them out of its
|
|
45
|
-
// pass, then plays them in a pass of their own (./cibles.mjs, scripts/verifier.mjs).
|
|
45
|
+
// pass, then plays them in a pass of their own (./cibles.mjs, scripts/langages/typescript/verifier.mjs).
|
|
46
46
|
// - While a run names its results directory (`GRILLHOUSE_RESULTATS`, ./resultats.mjs), the JSON
|
|
47
47
|
// reporter writes Vitest's report there too, which the circuit reads (scripts/resultats.mjs); a
|
|
48
48
|
// setup file gives each test file's processes a results directory of their own, so that a run a
|
|
49
49
|
// test plays in a repository of trial never writes in it (./resultats.setup.mjs).
|
|
50
50
|
// - A run of Vitest has a base of its own, as Bazel gives each test its TEST_TMPDIR: a plugin opens
|
|
51
51
|
// it while the configuration resolves, sweeping the orphan bases a killed run left, and names
|
|
52
|
-
// it in TMPDIR, so that Vitest's own temporary directory, each test process and
|
|
53
|
-
// start write there; the base is removed when the run exits, green or
|
|
54
|
-
// (
|
|
52
|
+
// it in TMPDIR, TMP and TEMP, so that Vitest's own temporary directory, each test process and
|
|
53
|
+
// everything they start write there; the base is removed when the run exits, green, red or
|
|
54
|
+
// interrupted (SIGINT, SIGTERM, SIGHUP). It is the guard of the temporary directory of the
|
|
55
|
+
// module typescript: what the tests left there at the end of the run, once Vitest removed its
|
|
56
|
+
// own directory, fails the run, each name written, the caches of the tools a test launches
|
|
57
|
+
// tolerated by name (`CACHES_DES_OUTILS`, below) (`baseDeVitest`, below; the base,
|
|
58
|
+
// scripts/mesure/base-de-passe.mjs). A test makes its temporary directory with
|
|
59
|
+
// `mkdtempSync(path.join(tmpdir(), '<prefix>-'))` and removes it in `afterAll` (`rmSync`,
|
|
60
|
+
// `recursive` and `force`), a red test included.
|
|
55
61
|
// - While a run names the progress directory of its pass (`GRILLHOUSE_AVANCEMENT`,
|
|
56
|
-
//
|
|
62
|
+
// scripts/mesure/avancement.mjs), the reporter of progress writes there the files done and planned of its
|
|
57
63
|
// task at each test file done, which the board reads (scripts/avancement.mjs,
|
|
58
64
|
// scripts/tableau.mjs).
|
|
59
65
|
import { fileURLToPath } from 'node:url';
|
|
60
|
-
import {
|
|
66
|
+
import { ligneDesRestes, ouvrirBase, retirerALInterruption } from '../../../services-du-noyau.mjs';
|
|
61
67
|
import { ciblage, HORS_DU_JOUR } from './cibles.mjs';
|
|
62
|
-
import { rapportAvancement } from './avancement.mjs';
|
|
68
|
+
import { rapportAvancement } from './avancement.reporter.mjs';
|
|
63
69
|
import { rapportJson } from './resultats.mjs';
|
|
64
70
|
|
|
65
71
|
const ici = f => fileURLToPath(new URL(f, import.meta.url));
|
|
66
72
|
|
|
73
|
+
// The variable that marks the base of a run of Vitest: `<process>:<base>`, the process that opened
|
|
74
|
+
// it. A configuration loaded again in that process (Vite bundles each load) keeps that base.
|
|
75
|
+
const MARQUE = 'GRILLHOUSE_BASE_DE_VITEST';
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The caches the tools a test launches keep in the temporary directory, which the guard of the
|
|
79
|
+
* base tolerates, by name, at its root (the base removes them with the rest):
|
|
80
|
+
* - `node-compile-cache`: Node's compile cache, which npm enables (`module.enableCompileCache()`)
|
|
81
|
+
* under `os.tmpdir()`. Its variable, NODE_COMPILE_CACHE, enables the cache in every Node the
|
|
82
|
+
* tests start, written out of the pass for good;
|
|
83
|
+
* - `claude-<uid>`: the temporary directory of Claude Code (`CLAUDE_CODE_TMPDIR`, else
|
|
84
|
+
* `os.tmpdir()`), where a claude a test launches keeps its scratchpads. Its variable named out
|
|
85
|
+
* of the pass would bring them back into the machine's /tmp (grillhouse-3uv.93: 18 835
|
|
86
|
+
* directories of `/tmp/claude-1000` left by the envelopes of trial copies).
|
|
87
|
+
*/
|
|
88
|
+
const CACHES_DES_OUTILS = new Set(['node-compile-cache', `claude-${process.getuid?.() ?? ''}`]);
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* The plugin of the base configuration that gives a run of Vitest its base: while Vite resolves
|
|
92
|
+
* the configuration, before Vitest makes its own temporary directory (`join(tmpdir(), nanoid())`,
|
|
93
|
+
* its transformed modules), the main process opens a base of genre `vitest` and names it in its
|
|
94
|
+
* `TMPDIR`, `TMP` and `TEMP`, which every test process inherits. When the process exits, what is
|
|
95
|
+
* left in the base fails the run, named on the error stream (Vitest removed its own directory at
|
|
96
|
+
* its close); then the base goes. An interruption removes it too. A process that already opened
|
|
97
|
+
* its base keeps it.
|
|
98
|
+
* @returns {{ name: string, config: () => void }} a plugin of Vite
|
|
99
|
+
*/
|
|
100
|
+
function baseDeVitest() {
|
|
101
|
+
return {
|
|
102
|
+
name: 'grillhouse:base-de-passe',
|
|
103
|
+
config() {
|
|
104
|
+
if (process.env[MARQUE]?.startsWith(`${process.pid}:`)) return;
|
|
105
|
+
const b = ouvrirBase('vitest');
|
|
106
|
+
process.env[MARQUE] = `${process.pid}:${b.base}`;
|
|
107
|
+
Object.assign(process.env, b.env);
|
|
108
|
+
retirerALInterruption(b.fermer);
|
|
109
|
+
process.on('exit', () => {
|
|
110
|
+
const ligne = ligneDesRestes(b.restes().filter(n => !CACHES_DES_OUTILS.has(n)));
|
|
111
|
+
if (ligne) {
|
|
112
|
+
process.stderr.write(`${ligne}\n`);
|
|
113
|
+
process.exitCode = 1;
|
|
114
|
+
}
|
|
115
|
+
b.fermer();
|
|
116
|
+
});
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
67
121
|
export default {
|
|
68
122
|
plugins: [baseDeVitest(), ciblage()],
|
|
69
123
|
test: {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// - The variable `GRILLHOUSE_CHANGEMENTS` names a JSON file, `{ racine, fichiers, supprimes }`: the
|
|
11
11
|
// top of the repository, the files changed or added since the last green and the files removed,
|
|
12
12
|
// each path from the top. It passes through Turborepo without entering any hash (the root's
|
|
13
|
-
// `globalPassThroughEnv`, which scripts/turbo-des-paquets.mjs writes and checks): a package whose
|
|
13
|
+
// `globalPassThroughEnv`, which scripts/langages/typescript/turbo-des-paquets.mjs writes and checks): a package whose
|
|
14
14
|
// inputs did not move replays its last green from Turborepo's cache, whatever the last green.
|
|
15
15
|
// The plugin takes it out of the environment once read: no process the tests start receives it.
|
|
16
16
|
// - The graph of a test is the test file and the modules it imports, statically or dynamically,
|
|
@@ -25,15 +25,17 @@
|
|
|
25
25
|
// `vite.config.*`, `vitest.workspace.*`, `tsconfig*.json`; its `setupFiles` and its
|
|
26
26
|
// `globalSetup`, which Vitest runs beside the graph;
|
|
27
27
|
// 5. a path its tests declare they read (`grillhouse.lit` of its package.json, from the top):
|
|
28
|
-
// a
|
|
29
|
-
//
|
|
30
|
-
//
|
|
28
|
+
// a directory or a file out of the package that its tests read as a whole (the templates,
|
|
29
|
+
// the plugin, the configuration of the repository), as Bazel's `data`, named file by file
|
|
30
|
+
// where the frame rewrites their neighbours (the hooks and configuration of `.beads`, never
|
|
31
|
+
// its journals, `interactions.jsonl`, which each command of bd writes); a script of the
|
|
32
|
+
// package that a test launches needs none, the test naming its path (./lances.mjs);
|
|
31
33
|
// 6. a file, changed or removed, that the build of a package it depends on reads (its
|
|
32
34
|
// `dependencies`, `devDependencies`, `optionalDependencies` and `peerDependencies` that
|
|
33
35
|
// resolve to a directory of the repository, out of node_modules, transitively): its tests read
|
|
34
36
|
// that package built, not the source git follows. As Turborepo hashes the inputs of a
|
|
35
37
|
// neighbour's `build` task and Bazel the `srcs` of its target, the build reads the inputs of
|
|
36
|
-
// the `build` of the neighbour's turbo.json, the one scripts/turbo-des-paquets.mjs generates,
|
|
38
|
+
// the `build` of the neighbour's turbo.json, the one scripts/langages/typescript/turbo-des-paquets.mjs generates,
|
|
37
39
|
// as Turborepo reads them: each pattern from the package, `$TURBO_ROOT$/…` from the top, `!…`
|
|
38
40
|
// an exclusion, `<x>/**` covering `<x>` itself, `$TURBO_DEFAULT$` every file of the package,
|
|
39
41
|
// `$TURBO_EXTENDS$` the inputs of the root's `build` (turbo.json or turbo.jsonc). When they
|
|
@@ -46,18 +48,21 @@
|
|
|
46
48
|
// Vitest's own `forceRerunTriggers` (a configuration's, or its default) still apply, as with
|
|
47
49
|
// `--changed`.
|
|
48
50
|
// - Otherwise the tests played are those Vitest relates to the files changed or added (`related`,
|
|
49
|
-
// absolute),
|
|
50
|
-
//
|
|
51
|
+
// absolute), the tests that read one of them by its path, a script they launch or a file they
|
|
52
|
+
// read, with what it imports and names (`testsQuiLancent`, ./lances.mjs, as Bazel's `data`),
|
|
53
|
+
// and the files a targeted run names themselves (./cibles.mjs): a file named plays, changed or
|
|
54
|
+
// not. A package where none relates plays none and passes
|
|
51
55
|
// (`passWithNoTests`), as Vitest's `--changed` has it.
|
|
52
56
|
//
|
|
53
|
-
// This module's top level uses Node alone (./cibles.mjs, scripts/tests.mjs import it); a
|
|
57
|
+
// This module's top level uses Node alone (./cibles.mjs, scripts/langages/typescript/tests.mjs import it); a
|
|
54
58
|
// turbo.json is read with jsonc-parser, the frame's reader of JSON with comments, loaded then.
|
|
55
59
|
import { existsSync, readFileSync, realpathSync } from 'node:fs';
|
|
56
60
|
import { createRequire } from 'node:module';
|
|
57
61
|
import path from 'node:path';
|
|
58
62
|
import { fileURLToPath } from 'node:url';
|
|
63
|
+
import { CHANGEMENTS } from '../../../services-du-noyau.mjs';
|
|
64
|
+
import { testsQuiLancent } from './lances.mjs';
|
|
59
65
|
|
|
60
|
-
export const CHANGEMENTS = 'GRILLHOUSE_CHANGEMENTS';
|
|
61
66
|
// This directory, the frame's base configuration.
|
|
62
67
|
const BASE = path.dirname(fileURLToPath(import.meta.url));
|
|
63
68
|
// The extension of a module, which a graph of Vitest can hold.
|
|
@@ -219,9 +224,11 @@ export function restreindre(test, dossier, ch, nommes, dire) {
|
|
|
219
224
|
dire(`↳ ${nom} : tous ses tests, ${entier.raison} (${entier.fichier}).`);
|
|
220
225
|
return;
|
|
221
226
|
}
|
|
222
|
-
|
|
227
|
+
const changes = ch.fichiers.map(f => path.join(ch.racine, f));
|
|
228
|
+
const lanceurs = testsQuiLancent(dossier, ch.racine, changes);
|
|
229
|
+
test.related = [...new Set([...changes, ...nommes, ...lanceurs])];
|
|
223
230
|
test.passWithNoTests = true;
|
|
224
231
|
dire(
|
|
225
|
-
`↳ ${nom} : les tests que Vitest relie aux ${ch.fichiers.length} fichier(s) changé(s) depuis le dernier vert.`
|
|
232
|
+
`↳ ${nom} : les tests que Vitest relie aux ${ch.fichiers.length} fichier(s) changé(s) depuis le dernier vert${lanceurs.length ? `, et ${lanceurs.length} test(s) qui en lisent un par son chemin` : ''}.`
|
|
226
233
|
);
|
|
227
234
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// The tests a targeted run names (`npm test -- <paths>`, scripts/tests.mjs), carried to Vitest by
|
|
1
|
+
// The tests a targeted run names (`npm test -- <paths>`, scripts/langages/typescript/tests.mjs), carried to Vitest by
|
|
2
2
|
// the variable `GRILLHOUSE_TESTS` rather than by its command line: the arguments after `--` of a
|
|
3
3
|
// Turborepo run enter the hash of every task of that run, the builds included, while a variable
|
|
4
|
-
// that the `env` of the task `test:
|
|
4
|
+
// that the `env` of the task `test:unit` names enters the hash of the tests alone
|
|
5
5
|
// (https://turborepo.dev/docs/reference/configuration#env). Turborepo then plays the tests with
|
|
6
6
|
// what they depend on, each build and each trace hashed by Turborepo itself.
|
|
7
7
|
//
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
// - The time witnesses play alone, as Bazel plays a test tagged `exclusive` after the others, with
|
|
31
31
|
// nothing beside it: a time witness is a test file that imports the mark of a measure of time
|
|
32
32
|
// (`import { mesurerAuRepos } from '@roomi-fields/grillhouse/vitest-config/mesure'`, a line of its own,
|
|
33
|
-
// `estTemoin`). `npm run verifier` (scripts/verifier.mjs) plays its pass with `temoins: 'hors'`
|
|
33
|
+
// `estTemoin`). `npm run verifier` (scripts/langages/typescript/verifier.mjs) plays its pass with `temoins: 'hors'`
|
|
34
34
|
// in the value, which leaves every witness of the configuration's `include` out, then a pass of
|
|
35
35
|
// its own with `temoins: 'seuls'`, which plays the witnesses alone, one file at a time
|
|
36
36
|
// (`fileParallelism: false`), and passes without one (`passWithNoTests`); a targeted run sets
|
|
@@ -41,14 +41,15 @@
|
|
|
41
41
|
// files played to those Vitest relates to them, the files named themselves kept, or leave every
|
|
42
42
|
// test when a change lies out of Vitest's graph.
|
|
43
43
|
//
|
|
44
|
-
// This module's top level uses Node alone: scripts/tests.mjs reads its VARIABLE.
|
|
44
|
+
// This module's top level uses Node alone: scripts/langages/typescript/tests.mjs reads its VARIABLE.
|
|
45
45
|
import { globSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
46
46
|
import path from 'node:path';
|
|
47
|
-
import { CHANGEMENTS
|
|
47
|
+
import { CHANGEMENTS } from '../../../services-du-noyau.mjs';
|
|
48
|
+
import { lireChangements, restreindre } from './changements.mjs';
|
|
48
49
|
|
|
49
50
|
export const VARIABLE = 'GRILLHOUSE_TESTS';
|
|
50
51
|
// The day's exclusions, which the base configuration (./base.mjs) sets and the night plays
|
|
51
|
-
// (scripts/vitest.nuit.config.mjs): the night tests, too long for the day, and the time budget
|
|
52
|
+
// (scripts/langages/typescript/vitest.nuit.config.mjs): the night tests, too long for the day, and the time budget
|
|
52
53
|
// benches, whose measures move with the load of the day.
|
|
53
54
|
export const NUIT = '**/*.nuit.{test,spec}.?(c|m)[jt]s?(x)';
|
|
54
55
|
export const BUDGET = '**/*.budget.{test,spec}.?(c|m)[jt]s?(x)';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// The types of ./duree.reporter.mjs, for a strict TypeScript Vitest configuration that names
|
|
2
|
+
// `@roomi-fields/grillhouse/vitest-config/duree` in its reporters.
|
|
3
|
+
import type { Reporter } from 'vitest/reporters';
|
|
4
|
+
|
|
5
|
+
// The duration reporter: Vitest's exit code becomes 75 when every failure depends on a duration and
|
|
6
|
+
// one took place under load.
|
|
7
|
+
export default class DureeReporter implements Reporter {
|
|
8
|
+
onInit: Reporter['onInit'];
|
|
9
|
+
onFinished: Reporter['onFinished'];
|
|
10
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
// The duration reporter of the base configuration, beside Vitest's default reporter
|
|
2
|
-
//
|
|
1
|
+
// The duration reporter of the base configuration, beside Vitest's default reporter; a project
|
|
2
|
+
// names it by its published entry, `@roomi-fields/grillhouse/vitest-config/duree`
|
|
3
|
+
// (`--reporter=<entry>`, or `reporters` in a configuration; types ./duree.reporter.d.ts). At the end
|
|
4
|
+
// of a run with failures, it reads each one:
|
|
3
5
|
//
|
|
4
6
|
// - a failure depends on a duration when it is a delay past (an error « Test timed out in <n>ms. »
|
|
5
7
|
// or « Hook timed out in <n>ms. », Vitest's own message), a failure of a time budget bench (a
|
|
@@ -15,7 +17,12 @@
|
|
|
15
17
|
// that does not read. Each failure of duration is written with the pressure measured and the
|
|
16
18
|
// threshold; a pressure that does not read is said, « pression CPU illisible ».
|
|
17
19
|
import path from 'node:path';
|
|
18
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
A_REPASSER,
|
|
22
|
+
ecrirePression,
|
|
23
|
+
lirePression,
|
|
24
|
+
SEUIL_PRESSION,
|
|
25
|
+
} from '../../../services-du-noyau.mjs';
|
|
19
26
|
|
|
20
27
|
const DELAI = /^(Test|Hook) timed out in \d+ms\./;
|
|
21
28
|
const BANC = /\.budget\.(test|spec)\.(c|m)?[jt]sx?$/;
|