@roomi-fields/grillhouse 0.24.15 → 0.25.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/bin/grillhouse.mjs +40 -12
- package/cadre/templates/cargo/.config/nextest.toml +8 -0
- package/cadre/templates/cargo/deny.toml +36 -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 +157 -54
- package/docs/CADRE.md +47 -0
- package/docs/INTERFACE.md +168 -0
- package/package.json +62 -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/{vitest-config → langages/typescript/vitest-config}/duree.reporter.mjs +6 -1
- 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
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The night tests of a project, the command `tests-de-nuit` of the module typescript
|
|
3
|
+
// (scripts/jointure.d.ts), which the night (scripts/nuit.sh) runs in its copy after the full pass,
|
|
4
|
+
// through its mounts.
|
|
5
|
+
//
|
|
6
|
+
// node tests-de-nuit.mjs from the root of the copy
|
|
7
|
+
//
|
|
8
|
+
// - The files `*.nuit.test.*`, `*.nuit.spec.*`, `*.budget.test.*` and `*.budget.spec.*` of the
|
|
9
|
+
// copy, outside node_modules, dist and .git: the night tests and the time budget benches, which
|
|
10
|
+
// `npm test` and the integration leave out (./vitest-config/cibles.mjs, HORS_DU_JOUR). A copy
|
|
11
|
+
// with neither plays none, and the exit code is 0.
|
|
12
|
+
// - Vitest plays them with the frame's configuration (./vitest.nuit.config.mjs), from the root of
|
|
13
|
+
// the copy, a bench or a night test alone as well: `npx --no-install vitest run --root <copie>
|
|
14
|
+
// --config <configuration>`. Its exit code is this command's: 75, « à repasser », when every
|
|
15
|
+
// failure depended on a duration, one under load (./vitest-config/duree.reporter.mjs).
|
|
16
|
+
import { spawnSync } from 'node:child_process';
|
|
17
|
+
import { readdirSync } from 'node:fs';
|
|
18
|
+
import path from 'node:path';
|
|
19
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
20
|
+
|
|
21
|
+
const CONFIGURATION = fileURLToPath(new URL('./vitest.nuit.config.mjs', import.meta.url));
|
|
22
|
+
const HORS = new Set(['node_modules', 'dist', '.git']);
|
|
23
|
+
const DE_NUIT = /\.(nuit|budget)\.(test|spec)\.(c|m)?[jt]sx?$/;
|
|
24
|
+
|
|
25
|
+
// Whether a night test or a bench lies under <dossier>.
|
|
26
|
+
function enTient(dossier) {
|
|
27
|
+
for (const e of readdirSync(dossier, { withFileTypes: true })) {
|
|
28
|
+
if (e.isDirectory()) {
|
|
29
|
+
if (!HORS.has(e.name) && enTient(path.join(dossier, e.name))) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
} else if (e.isFile() && DE_NUIT.test(e.name)) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Plays the night tests of the copy at <racine>: the exit code of Vitest, 0 when there is none.
|
|
41
|
+
* @param {string} racine the root of the copy
|
|
42
|
+
*/
|
|
43
|
+
export function testsDeNuit(racine) {
|
|
44
|
+
if (!enTient(racine)) {
|
|
45
|
+
return 0;
|
|
46
|
+
}
|
|
47
|
+
const r = spawnSync(
|
|
48
|
+
'npx',
|
|
49
|
+
['--no-install', 'vitest', 'run', '--root', racine, '--config', CONFIGURATION],
|
|
50
|
+
{ cwd: racine, stdio: 'inherit' }
|
|
51
|
+
);
|
|
52
|
+
return r.status ?? 1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
56
|
+
process.exitCode = testsDeNuit(process.cwd());
|
|
57
|
+
}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// The day's tests, as Turborepo's tasks (`npm test`, `npm run test:forcer`): the build, then the
|
|
3
|
-
// `test:
|
|
3
|
+
// `test:unit` of each package, an unchanged task replayed from Turborepo's cache.
|
|
4
4
|
//
|
|
5
5
|
// npx grillhouse tests [--force] [<path>…] [--<option>=<value>…]
|
|
6
6
|
//
|
|
7
|
-
// - Without a path, every package plays its tests (`turbo run test:
|
|
7
|
+
// - Without a path, every package plays its tests (`turbo run test:unit`); `--force` plays each
|
|
8
8
|
// task for real, the builds included (`npm run test:forcer`).
|
|
9
9
|
// - A path is written from the root of the repository: a test file or a directory. In a repository
|
|
10
|
-
// of packages, each path plays in the package that holds it: Turborepo runs the `test:
|
|
10
|
+
// of packages, each path plays in the package that holds it: Turborepo runs the `test:unit` of
|
|
11
11
|
// those packages only (`--filter=<name>`), and their Vitest receives each path made absolute,
|
|
12
12
|
// which it matches against its own test files (a path of another package matches none of them).
|
|
13
13
|
// Turborepo filters packages, not files, and Vitest resolves a relative path from the directory
|
|
14
14
|
// of the package that runs it, so the frame translates each path into its package; a Vitest at the
|
|
15
15
|
// root (its projects) would run each package's tests under the root's version, not the one the
|
|
16
16
|
// package declares. A path out of every package, in a package out of the frame
|
|
17
|
-
// (`docs/agents/hors-cadre.txt`), or in a package without a `test:
|
|
17
|
+
// (`docs/agents/hors-cadre.txt`), or in a package without a `test:unit` script is refused,
|
|
18
18
|
// named, and nothing plays. In a repository without packages, the paths go to the root's Vitest
|
|
19
19
|
// as they are.
|
|
20
20
|
// - The paths and the options reach Vitest in the variable `GRILLHOUSE_TESTS`
|
|
21
|
-
// (scripts/vitest-config/cibles.mjs), which the `env` of the task `test:
|
|
21
|
+
// (scripts/langages/typescript/vitest-config/cibles.mjs), which the `env` of the task `test:unit` names, never
|
|
22
22
|
// after `--`: Turborepo passes the arguments after `--` to the tasks the command names only, and
|
|
23
23
|
// counts them in the hash of every task of the run (its documentation, « Caching »: « including
|
|
24
24
|
// dependencies of `build` that did not receive `--arg=value` »), where a variable of a task's
|
|
25
25
|
// `env` enters that task's hash alone. So a run with paths is one Turborepo run of the tests with
|
|
26
|
-
// what they depend on (`turbo run test:
|
|
26
|
+
// what they depend on (`turbo run test:unit --filter=<name>`): the builds and the traces they
|
|
27
27
|
// wait for play first, from the cache when nothing moved, whatever paths are named, and the hash
|
|
28
28
|
// of the tests holds theirs, as Bazel's key of a target holds its transitive inputs; a change to
|
|
29
29
|
// a package the tests import, or to what they read, plays them again. Every other run of
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
// in a sandbox of Bazel: the build is the named packages' alone, with the traces of those
|
|
43
43
|
// packages their tests wait for, which live in the package the agent writes
|
|
44
44
|
// (`turbo run build <name>#trace:<t>… --only --filter=<name>`, their task ids read in
|
|
45
|
-
// Turborepo's plan of the tests, `turbo run test:
|
|
45
|
+
// Turborepo's plan of the tests, `turbo run test:unit --filter=<name> --dry=json`), never
|
|
46
46
|
// their dependencies nor a neighbour's trace; then the tests alone
|
|
47
|
-
// (`turbo run test:
|
|
47
|
+
// (`turbo run test:unit --only --filter=<name>`), the paths in the variable. A named package
|
|
48
48
|
// that the envelope shows read-only (one out of the plan; the shared test material, for every
|
|
49
49
|
// role but the testwriter) is not built, nor are its traces: it arrives built, as a read-only
|
|
50
50
|
// input of Bazel; the frame knows it read-only by testing its directory for writing
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
// - An argument that begins with « - » is an option of Vitest, written `--<name>=<value>`, carried
|
|
58
58
|
// in the variable beside the paths.
|
|
59
59
|
// - A night test or a time budget bench, which the day leaves out, plays when a path names its own
|
|
60
|
-
// file, under the measure of time of the day's configuration (scripts/vitest-config/cibles.mjs);
|
|
60
|
+
// file, under the measure of time of the day's configuration (scripts/langages/typescript/vitest-config/cibles.mjs);
|
|
61
61
|
// a directory or a package named leaves them out.
|
|
62
62
|
// - A run that plays no test fails: the frame's base configuration of Vitest keeps Vitest's
|
|
63
|
-
// `passWithNoTests: false` (scripts/vitest-config/base.mjs).
|
|
63
|
+
// `passWithNoTests: false` (scripts/langages/typescript/vitest-config/base.mjs).
|
|
64
64
|
// - Under the circuit's mark (`GRILLHOUSE_DEPUIS_LE_VERT`, its proof and its checks,
|
|
65
65
|
// scripts/circuit.mjs), a run measures itself against the last green, as `npm run verifier`
|
|
66
66
|
// does (scripts/dernier-vert.mjs): in a package or a directory named, the tests Vitest relates to
|
|
@@ -73,29 +73,37 @@
|
|
|
73
73
|
// - While the environment names the progress directory of a pass (`GRILLHOUSE_AVANCEMENT`,
|
|
74
74
|
// scripts/avancement.mjs: the circuit's proof and checks), each run of the tests plans its
|
|
75
75
|
// tasks first, and Vitest writes there the files done and planned of each.
|
|
76
|
-
// - The run has a base of its own (scripts/
|
|
77
|
-
// of the bases a killed run left: it names it in TMPDIR to every run of
|
|
78
|
-
// root's `globalPassThroughEnv` passes on to every task, and removes it
|
|
76
|
+
// - The run has a base of its own (scripts/mesure/base-de-passe.mjs), which it sweeps first
|
|
77
|
+
// of the bases a killed run left: it names it in TMPDIR, TMP and TEMP to every run of
|
|
78
|
+
// Turborepo, whose root's `globalPassThroughEnv` passes TMPDIR on to every task, and removes it
|
|
79
|
+
// at its end, green, red or interrupted (SIGINT, SIGTERM, SIGHUP).
|
|
79
80
|
// The exit code is Turborepo's; 2 for a path refused.
|
|
80
81
|
import { spawnSync } from 'node:child_process';
|
|
81
82
|
import { accessSync, constants, existsSync, readdirSync, statSync } from 'node:fs';
|
|
82
83
|
import path from 'node:path';
|
|
83
|
-
import {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
import {
|
|
85
|
+
AVANCEMENT,
|
|
86
|
+
CHANGEMENTS,
|
|
87
|
+
DEPUIS_LE_VERT,
|
|
88
|
+
mesure,
|
|
89
|
+
ouvrirBase,
|
|
90
|
+
paquetsDeLEnveloppe,
|
|
91
|
+
retirerALInterruption,
|
|
92
|
+
} from '../../services-du-noyau.mjs';
|
|
93
|
+
import { paquets } from '../../paquets.mjs';
|
|
94
|
+
import { garderLesResumes } from './verdict.mjs';
|
|
95
|
+
import { RESULTATS } from '../../resultats.mjs';
|
|
96
|
+
import { planifier, tracesDuPlan } from './turbo-des-paquets.mjs';
|
|
97
|
+
import { SCRIPT_DES_TESTS } from './script-des-tests.mjs';
|
|
89
98
|
import { VARIABLE } from './vitest-config/cibles.mjs';
|
|
90
|
-
import { CHANGEMENTS } from './vitest-config/changements.mjs';
|
|
91
|
-
import { DEPUIS_LE_VERT, mesure } from './dernier-vert.mjs';
|
|
92
|
-
import { ouvrirBase } from './vitest-config/base-de-passe.mjs';
|
|
93
99
|
|
|
94
100
|
const racine = process.cwd();
|
|
95
|
-
// The base of the run (scripts/
|
|
96
|
-
// Turborepo write in it (TMPDIR), and it goes at the end of the run
|
|
101
|
+
// The base of the run (scripts/mesure/base-de-passe.mjs): this process and every run of
|
|
102
|
+
// Turborepo write in it (TMPDIR, TMP, TEMP), and it goes at the end of the run, or at its
|
|
103
|
+
// interruption.
|
|
97
104
|
const base = ouvrirBase('tests');
|
|
98
|
-
process.env
|
|
105
|
+
Object.assign(process.env, base.env);
|
|
106
|
+
const lacher = retirerALInterruption(base.fermer);
|
|
99
107
|
const enveloppe = paquetsDeLEnveloppe() !== null;
|
|
100
108
|
const args = process.argv.slice(2);
|
|
101
109
|
const force = args.includes('--force');
|
|
@@ -118,7 +126,7 @@ const turbo = (args, tests) => {
|
|
|
118
126
|
const runs = path.join(racine, '.turbo', 'runs');
|
|
119
127
|
const avant = new Set(existsSync(runs) ? readdirSync(runs) : []);
|
|
120
128
|
// A run of the tests under a progress directory plans its tasks (scripts/avancement.mjs).
|
|
121
|
-
if (args[0] ===
|
|
129
|
+
if (args[0] === SCRIPT_DES_TESTS) {
|
|
122
130
|
planifier(env[AVANCEMENT], {
|
|
123
131
|
racine,
|
|
124
132
|
args: [...args, '--continue=dependencies-successful'],
|
|
@@ -138,7 +146,7 @@ const turbo = (args, tests) => {
|
|
|
138
146
|
// The trace tasks of the packages <noms> their tests wait for, read in Turborepo's plan of the
|
|
139
147
|
// tests <filtres> select: `{ ids }`; a plan that fails gives `{ code }`, its output written.
|
|
140
148
|
const traces = (filtres, noms) => {
|
|
141
|
-
const plan = spawnSync('turbo', ['run',
|
|
149
|
+
const plan = spawnSync('turbo', ['run', SCRIPT_DES_TESTS, ...filtres, '--dry=json'], {
|
|
142
150
|
cwd: racine,
|
|
143
151
|
encoding: 'utf8',
|
|
144
152
|
maxBuffer: 256 * 1024 * 1024,
|
|
@@ -155,7 +163,7 @@ const traces = (filtres, noms) => {
|
|
|
155
163
|
// Its exit code: the first that is not 0, else the tests'.
|
|
156
164
|
const cibles = (filtres, passes) => {
|
|
157
165
|
const tests = { arguments: passes, ...(force ? { rejouer: new Date().toISOString() } : {}) };
|
|
158
|
-
if (!enveloppe) return turbo([
|
|
166
|
+
if (!enveloppe) return turbo([SCRIPT_DES_TESTS, ...filtres], tests);
|
|
159
167
|
// A package the envelope shows read-only arrives built: only the packages it shows in writing
|
|
160
168
|
// build, as the envelope mounts them (`inscriptible`).
|
|
161
169
|
const construits = filtres.filter(f => inscriptible(dossiers.get(f.slice('--filter='.length))));
|
|
@@ -166,7 +174,7 @@ const cibles = (filtres, passes) => {
|
|
|
166
174
|
const construction = turbo(['build', ...propres.ids, '--only', ...construits]);
|
|
167
175
|
if (construction !== 0) return construction;
|
|
168
176
|
}
|
|
169
|
-
return turbo([
|
|
177
|
+
return turbo([SCRIPT_DES_TESTS, '--only', ...filtres], tests);
|
|
170
178
|
};
|
|
171
179
|
|
|
172
180
|
// True when this process may write the directory <dir>: false under a read-only mount.
|
|
@@ -187,7 +195,7 @@ const dossiers = new Map(liste.map(p => [p.pkg.name, path.join(racine, p.dossier
|
|
|
187
195
|
const lancer = () => {
|
|
188
196
|
if (chemins.length === 0) {
|
|
189
197
|
return turbo(
|
|
190
|
-
[
|
|
198
|
+
[SCRIPT_DES_TESTS, ...(force ? ['--force'] : [])],
|
|
191
199
|
options.length ? { arguments: options } : undefined
|
|
192
200
|
);
|
|
193
201
|
}
|
|
@@ -210,8 +218,8 @@ const lancer = () => {
|
|
|
210
218
|
refus.push(
|
|
211
219
|
`⛔ ${chemin} : ${p.dossier} est hors cadre (docs/agents/hors-cadre.txt) ; Turborepo n'en joue aucune tâche.`
|
|
212
220
|
);
|
|
213
|
-
} else if (typeof p.pkg.scripts?.[
|
|
214
|
-
refus.push(`⛔ ${chemin} : ${p.dossier} n'a pas de script
|
|
221
|
+
} else if (typeof p.pkg.scripts?.[SCRIPT_DES_TESTS] !== 'string') {
|
|
222
|
+
refus.push(`⛔ ${chemin} : ${p.dossier} n'a pas de script ${SCRIPT_DES_TESTS}.`);
|
|
215
223
|
} else {
|
|
216
224
|
noms.add(p.pkg.name);
|
|
217
225
|
// A directory ends with « / »: Vitest matches the start of a path, and packages/a is the start
|
|
@@ -233,6 +241,7 @@ const lancer = () => {
|
|
|
233
241
|
try {
|
|
234
242
|
process.exitCode = lancer();
|
|
235
243
|
} finally {
|
|
244
|
+
lacher();
|
|
236
245
|
depuis?.retirer();
|
|
237
246
|
base.fermer();
|
|
238
247
|
}
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
// }
|
|
63
63
|
//
|
|
64
64
|
// - `lit`: the paths its tests read, directories or files, data or code, a neighbour's scripts and
|
|
65
|
-
// sources included, as Bazel's `data` takes any file. Its `test:
|
|
65
|
+
// sources included, as Bazel's `data` takes any file. Its `test:unit` hashes them
|
|
66
66
|
// (`inputs`: the root's, `$TURBO_EXTENDS$`, or Turborepo's default, `$TURBO_DEFAULT$`, when the
|
|
67
67
|
// root's task sets none, since `$TURBO_EXTENDS$` then extends an empty list; then
|
|
68
68
|
// `$TURBO_ROOT$/<dir>/**` each) and waits, beside the root's `dependsOn`, for each trace whose
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
// output, `ecrit`, a directory inside the package that git ignores. A restore from the cache
|
|
74
74
|
// adds files and removes none: the command empties its directory before writing it.
|
|
75
75
|
// The traces a package's tests wait for are read in Turborepo's plan of its tests
|
|
76
|
-
// (`tracesDuPlan`), by the targeted run (scripts/tests.mjs) and the
|
|
77
|
-
// (
|
|
76
|
+
// (`tracesDuPlan`), by the targeted run (scripts/langages/typescript/tests.mjs) and the build of an
|
|
77
|
+
// agent's copy (./construire.mjs), which produce them before the tests; the envelope shows the
|
|
78
78
|
// directory of a neighbour's trace read-only (scripts/enveloppe/enveloppe.mjs), and the targeted
|
|
79
79
|
// run inside it plays the traces of the agent's package only.
|
|
80
80
|
// - The package holding a declared path of data alone (the shared test material) has its `build`
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
// and in the inputs it writes in a package's turbo.json; the check refuses a root input lacking it.
|
|
102
102
|
//
|
|
103
103
|
// The configuration of Vitest of the package of the shared test material (`matieres` of
|
|
104
|
-
// scripts/consommateurs.mjs) is CommonJS (`vitest.config.cjs`): the envelope shows that package
|
|
104
|
+
// scripts/langages/typescript/consommateurs.mjs) is CommonJS (`vitest.config.cjs`): the envelope shows that package
|
|
105
105
|
// read-only to every role but the testwriter (scripts/enveloppe/enveloppe.mjs), and Vite 5 loads a
|
|
106
106
|
// CommonJS configuration in memory, where it bundles an ESM one into a file beside it
|
|
107
107
|
// (`vitest.config.mjs.timestamp-<n>.mjs`). The check refuses a `vitest.config.mjs` or `.mts` of
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
//
|
|
124
124
|
// The typing of each package (`typecheck`, its script, as `check-types` in the examples of
|
|
125
125
|
// create-turbo), which `npm run verifier` plays beside the guards and the tests: a task of the
|
|
126
|
-
// root's turbo.json (or turbo.jsonc), cached per package, that waits, as `test:
|
|
126
|
+
// root's turbo.json (or turbo.jsonc), cached per package, that waits, as `test:unit`, for the
|
|
127
127
|
// build of its own package (`build`: the tests of BPScript's 990-corpus import its built entry,
|
|
128
128
|
// `990-corpus/test-fixtures`) and, in a repository of packages, for the build of each package its
|
|
129
129
|
// package declares (`^build`), whose types it reads; a package without a `typecheck` script plays
|
|
@@ -132,11 +132,11 @@
|
|
|
132
132
|
// lacks, the rest of the task kept; the check refuses either. Witness: BPScript 320.21.4, whose type errors in test/ showed only at night.
|
|
133
133
|
//
|
|
134
134
|
// The tests of a targeted run: the paths reach Vitest in the variable `GRILLHOUSE_TESTS`
|
|
135
|
-
// (scripts/vitest-config/cibles.mjs, scripts/tests.mjs), which the `env` of the root's
|
|
136
|
-
// `test:
|
|
137
|
-
// (Turborepo's strict mode of the variables). A package's own `test:
|
|
138
|
-
// inherits the root's. The generator adds the variable to the `env` of the root's `test:
|
|
139
|
-
// the project's entries kept, and the check refuses a `test:
|
|
135
|
+
// (scripts/langages/typescript/vitest-config/cibles.mjs, scripts/langages/typescript/tests.mjs), which the `env` of the root's
|
|
136
|
+
// `test:unit` names: it enters the hash of the tests alone, and reaches their process alone
|
|
137
|
+
// (Turborepo's strict mode of the variables). A package's own `test:unit` sets no `env`, and
|
|
138
|
+
// inherits the root's. The generator adds the variable to the `env` of the root's `test:unit`,
|
|
139
|
+
// the project's entries kept, and the check refuses a `test:unit` of the root without it.
|
|
140
140
|
//
|
|
141
141
|
// Four variables pass to every task without entering any hash: the root's `globalPassThroughEnv`
|
|
142
142
|
// names them, Turborepo's strict mode of the variables keeping out of a task every variable its
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
// Vitest relates to them, while a package whose inputs did not move replays from the cache; the
|
|
148
148
|
// progress directory of a pass (`GRILLHOUSE_AVANCEMENT`, scripts/avancement.mjs), where Vitest
|
|
149
149
|
// writes the files done and planned of each task, which the board reads; the temporary directory
|
|
150
|
-
// (`TMPDIR`), the base of a pass (scripts/
|
|
150
|
+
// (`TMPDIR`), the base of a pass (scripts/mesure/base-de-passe.mjs), where every task writes
|
|
151
151
|
// its temporary files and which goes at the end of the pass. The generator adds each
|
|
152
152
|
// one the root lacks, the project's entries kept, and the check refuses a
|
|
153
153
|
// root without one.
|
|
@@ -162,12 +162,12 @@ import { createRequire } from 'node:module';
|
|
|
162
162
|
import path from 'node:path';
|
|
163
163
|
import { pathToFileURL } from 'node:url';
|
|
164
164
|
import { applyEdits, modify, parse } from 'jsonc-parser';
|
|
165
|
+
import { AVANCEMENT, CHANGEMENTS, inscrireLePlan } from '../../services-du-noyau.mjs';
|
|
165
166
|
import { matieres, parcourir } from './consommateurs.mjs';
|
|
166
|
-
import { paquets } from '
|
|
167
|
-
import { ecrireSarif, RESULTATS } from '
|
|
167
|
+
import { paquets, TYPAGE } from '../../paquets.mjs';
|
|
168
|
+
import { ecrireSarif, RESULTATS } from '../../resultats.mjs';
|
|
169
|
+
import { SCRIPT_DES_TESTS as TESTS } from './script-des-tests.mjs';
|
|
168
170
|
import { VARIABLE as TESTS_CIBLES } from './vitest-config/cibles.mjs';
|
|
169
|
-
import { AVANCEMENT } from './vitest-config/avancement.mjs';
|
|
170
|
-
import { CHANGEMENTS } from './vitest-config/changements.mjs';
|
|
171
171
|
|
|
172
172
|
export const TURBO = 'turbo.json';
|
|
173
173
|
export const COMMANDE = 'npx grillhouse turbo-des-paquets --ecrire';
|
|
@@ -181,13 +181,9 @@ const RACINES = ['turbo.json', 'turbo.jsonc'];
|
|
|
181
181
|
export const GARDES = ['grillhouse:gardes', 'gardes'];
|
|
182
182
|
// The layout of what the generator writes in the root's turbo.json.
|
|
183
183
|
const MISE_EN_FORME = { formattingOptions: { insertSpaces: true, tabSize: 2, eol: '\n' } };
|
|
184
|
-
// The test task of a package, and the prefix of a trace task.
|
|
185
|
-
const TESTS = 'test:vitest';
|
|
186
|
-
// The typing task of each package.
|
|
187
|
-
export const TYPAGE = 'typecheck';
|
|
188
184
|
// The builds the typing of a package waits for in <racine>: its own, whose built entry its tests
|
|
189
185
|
// may import (990-corpus/test-fixtures), and, in a repository of packages, those of its
|
|
190
|
-
// dependencies, as `test:
|
|
186
|
+
// dependencies, as `test:unit`.
|
|
191
187
|
const attenteDuTypage = racine => (paquets(racine).length ? ['build', '^build'] : ['build']);
|
|
192
188
|
// The temporary directory of a process, which names the base of its pass.
|
|
193
189
|
const TEMPORAIRE = 'TMPDIR';
|
|
@@ -202,6 +198,7 @@ const POURQUOI = {
|
|
|
202
198
|
[TEMPORAIRE]:
|
|
203
199
|
'la base de la passe, où chaque tâche écrit ses fichiers temporaires, effacée à sa fin',
|
|
204
200
|
};
|
|
201
|
+
// The prefix of a trace task.
|
|
205
202
|
const TRACE = 'trace:';
|
|
206
203
|
// The files a build compiles: TypeScript's sources and declarations (tsc's default `include`
|
|
207
204
|
// takes a `.d.ts` into the program, whose types the build checks) and JavaScript (`allowJs`).
|
|
@@ -252,6 +249,35 @@ export const tracesDuPlan = (plan, garder = () => true) =>
|
|
|
252
249
|
.map(t => t.taskId)
|
|
253
250
|
.sort();
|
|
254
251
|
|
|
252
|
+
/**
|
|
253
|
+
* Before a run of Turborepo of <args> in <racine> under <env>, while <dossier> is a progress
|
|
254
|
+
* directory (scripts/avancement.mjs): the plan of the run (`turbo run … --dry=json`), its tasks of
|
|
255
|
+
* tests and those Turborepo replays from its cache, inscribed in the progress (`inscrireLePlan`).
|
|
256
|
+
* A plan that does not read changes nothing.
|
|
257
|
+
* @param {string | undefined} dossier
|
|
258
|
+
* @param {{ racine: string, args: string[], env?: Record<string, string | undefined> }} o
|
|
259
|
+
*/
|
|
260
|
+
export function planifier(dossier, { racine, args, env = process.env }) {
|
|
261
|
+
if (!dossier) return;
|
|
262
|
+
const r = spawnSync('turbo', ['run', ...args.filter(a => a !== '--summarize'), '--dry=json'], {
|
|
263
|
+
cwd: racine,
|
|
264
|
+
env,
|
|
265
|
+
encoding: 'utf8',
|
|
266
|
+
maxBuffer: 256 * 1024 * 1024,
|
|
267
|
+
});
|
|
268
|
+
let plan;
|
|
269
|
+
try {
|
|
270
|
+
plan = JSON.parse(r.stdout);
|
|
271
|
+
} catch {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
const taches = (plan?.tasks ?? []).filter(t => t.task === TESTS && t.hash);
|
|
275
|
+
inscrireLePlan(dossier, {
|
|
276
|
+
racine,
|
|
277
|
+
taches: taches.map(t => ({ hash: t.hash, cache: t.cache?.status === 'HIT' })),
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
|
|
255
281
|
// The tasks of a plan of Turborepo (`turbo run … --dry=json`, parsed) that wait, directly or not,
|
|
256
282
|
// for a task of one of the packages <paquets>, those tasks included: their task ids. As Bazel
|
|
257
283
|
// under --keep_going, a task that waits for a target of the plan goes with the plan, whose failure
|
|
@@ -648,9 +674,9 @@ function typageEcarte(racine) {
|
|
|
648
674
|
return { f: r.f, chemin, valeur: [...actuel, ...manques], manques };
|
|
649
675
|
}
|
|
650
676
|
|
|
651
|
-
// The `env` the `test:
|
|
677
|
+
// The `env` the `test:unit` of the root's turbo.json at <racine> must hold, TESTS_CIBLES added
|
|
652
678
|
// to the project's, when it lacks it: { f, attendu }; null when it holds it, without a root
|
|
653
|
-
// configuration or a `test:
|
|
679
|
+
// configuration or a `test:unit` in it, and when it is no JSON.
|
|
654
680
|
function testsSansVariable(racine) {
|
|
655
681
|
const r = confRacine(racine);
|
|
656
682
|
const tache = r?.conf.tasks?.[TESTS];
|
|
@@ -895,7 +921,7 @@ function racineRefusee(racine) {
|
|
|
895
921
|
|
|
896
922
|
// The refusals of <racine>: one line per package turbo.json absent or other than generated, per
|
|
897
923
|
// guard task of the root absent or whose dependsOn differs, for a typing task of the root absent
|
|
898
|
-
// or that does not wait for the build of its package and of its dependencies, for a root `test:
|
|
924
|
+
// or that does not wait for the build of its package and of its dependencies, for a root `test:unit` whose `env`
|
|
899
925
|
// lacks TESTS_CIBLES, per variable of PASSAGES the root's `globalPassThroughEnv` lacks, per configuration
|
|
900
926
|
// of a package written by hand in the root's turbo.json, and per declaration of data or trace
|
|
901
927
|
// refused.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// The verdict of a run of the module typescript, the third demand of the join
|
|
2
|
+
// (scripts/jointure.d.ts, `verdict`): what a run of Turborepo and of Vitest left in the results
|
|
3
|
+
// directory of a pass (`GRILLHOUSE_RESULTATS`, scripts/resultats.mjs).
|
|
4
|
+
//
|
|
5
|
+
// - The summary of a run of Turborepo (`turbo run … --summarize`, `.turbo/runs/<id>.json`):
|
|
6
|
+
// `garderLesResumes` moves the summaries a run wrote into `<dossier>/turbo/`, and `lireResumes`
|
|
7
|
+
// gives each task, its package and directory, its script, its exit code, its cache status and
|
|
8
|
+
// its log file (from the root), and whether it plays the tests of its package (`test:unit`).
|
|
9
|
+
// - The JSON report of Vitest, which the frame's base configuration writes under
|
|
10
|
+
// `<dossier>/vitest/` while the variable is set (scripts/langages/typescript/vitest-config/resultats.mjs):
|
|
11
|
+
// `lireRapportsVitest` gives each test file, its status, the message of a file that does not
|
|
12
|
+
// load, and each test, its title, its full name, its status and its first message.
|
|
13
|
+
import {
|
|
14
|
+
copyFileSync,
|
|
15
|
+
existsSync,
|
|
16
|
+
mkdirSync,
|
|
17
|
+
readdirSync,
|
|
18
|
+
readFileSync,
|
|
19
|
+
rmdirSync,
|
|
20
|
+
rmSync,
|
|
21
|
+
} from 'node:fs';
|
|
22
|
+
import path from 'node:path';
|
|
23
|
+
import { RESULTATS } from '../../resultats.mjs';
|
|
24
|
+
import { SCRIPT_DES_TESTS } from './script-des-tests.mjs';
|
|
25
|
+
import { VITEST } from './vitest-config/resultats.mjs';
|
|
26
|
+
|
|
27
|
+
const TURBO = 'turbo';
|
|
28
|
+
|
|
29
|
+
const fichiers = (dossier, extension) =>
|
|
30
|
+
existsSync(dossier)
|
|
31
|
+
? readdirSync(dossier)
|
|
32
|
+
.filter(f => f.endsWith(extension))
|
|
33
|
+
.sort()
|
|
34
|
+
.map(f => path.join(dossier, f))
|
|
35
|
+
: [];
|
|
36
|
+
const lireJson = f => {
|
|
37
|
+
try {
|
|
38
|
+
return JSON.parse(readFileSync(f, 'utf8'));
|
|
39
|
+
} catch {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// Moves the summaries of Turborepo that a run in <racine> wrote (`.turbo/runs/*.json` absent from
|
|
45
|
+
// <avant>, the names there before it) into the results directory <env> names; removes them
|
|
46
|
+
// without it. `.turbo/runs` goes too when the run created it (<avant> empty) and it is left empty.
|
|
47
|
+
export function garderLesResumes(racine, avant, env = process.env) {
|
|
48
|
+
const runs = path.join(racine, '.turbo', 'runs');
|
|
49
|
+
const neufs = (existsSync(runs) ? readdirSync(runs) : []).filter(
|
|
50
|
+
f => !avant.has(f) && f.endsWith('.json')
|
|
51
|
+
);
|
|
52
|
+
const dossier = env[RESULTATS];
|
|
53
|
+
for (const f of neufs) {
|
|
54
|
+
if (dossier) {
|
|
55
|
+
mkdirSync(path.join(dossier, TURBO), { recursive: true });
|
|
56
|
+
// The results directory may lie on another file system: a copy, then the removal.
|
|
57
|
+
copyFileSync(path.join(runs, f), path.join(dossier, TURBO, f));
|
|
58
|
+
rmSync(path.join(runs, f), { force: true });
|
|
59
|
+
} else rmSync(path.join(runs, f), { force: true });
|
|
60
|
+
}
|
|
61
|
+
if (neufs.length && !avant.size && existsSync(runs) && readdirSync(runs).length === 0) {
|
|
62
|
+
rmdirSync(runs);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// The tasks of the summaries of Turborepo under the results directory <dossier>, in their order:
|
|
67
|
+
// `{ tache, paquet, dossier, script, tests, code, cache, journal }`, `dossier` « . » for the root,
|
|
68
|
+
// `code` null for a task that did not run.
|
|
69
|
+
export function lireResumes(dossier) {
|
|
70
|
+
return fichiers(path.join(dossier, TURBO), '.json').flatMap(f =>
|
|
71
|
+
(lireJson(f)?.tasks ?? []).map(t => ({
|
|
72
|
+
tache: t.taskId,
|
|
73
|
+
paquet: t.package,
|
|
74
|
+
dossier: t.directory || '.',
|
|
75
|
+
script: t.task,
|
|
76
|
+
tests: t.task === SCRIPT_DES_TESTS,
|
|
77
|
+
code: t.execution?.exitCode ?? null,
|
|
78
|
+
cache: t.cache?.status ?? null,
|
|
79
|
+
journal: t.logFile ?? null,
|
|
80
|
+
}))
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// The test files of the reports of Vitest under the results directory <dossier>: `{ fichier,
|
|
85
|
+
// etat, message, tests }`, `fichier` its absolute path, each test `{ titre, nom, etat, message }`.
|
|
86
|
+
export function lireRapportsVitest(dossier) {
|
|
87
|
+
return fichiers(path.join(dossier, VITEST), '.json').flatMap(f =>
|
|
88
|
+
(lireJson(f)?.testResults ?? []).map(r => ({
|
|
89
|
+
fichier: r.name,
|
|
90
|
+
etat: r.status,
|
|
91
|
+
message: String(r.message ?? ''),
|
|
92
|
+
tests: (r.assertionResults ?? []).map(a => ({
|
|
93
|
+
titre: a.title,
|
|
94
|
+
nom: a.fullName || a.title,
|
|
95
|
+
etat: a.status,
|
|
96
|
+
message: String(a.failureMessages?.[0] ?? ''),
|
|
97
|
+
})),
|
|
98
|
+
}))
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// The verdict the results directory <dossier> holds: `{ rapports, taches }`.
|
|
103
|
+
export function verdict(dossier) {
|
|
104
|
+
return { rapports: lireRapportsVitest(dossier), taches: lireResumes(dossier) };
|
|
105
|
+
}
|