@roomi-fields/grillhouse 0.31.0 → 0.33.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 +40 -0
- package/bin/grillhouse.mjs +6 -4
- package/cadre/templates/projet/.github/workflows/ci.yml +136 -16
- package/cadre/templates/projet/.github/workflows/nuit.yml +111 -0
- package/cadre/templates/projet/deployment/docs/01-INSTALL.md +4 -4
- package/cadre/templates/projet/package.json +2 -2
- package/charte.md +8 -5
- package/dist/temporal/circuit/contrat.d.ts +15 -0
- package/dist/temporal/circuit/deroule.js +37 -14
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/deroules.d.ts +1 -0
- package/dist/temporal/deroules.js +3 -1
- package/dist/temporal/deroules.js.map +1 -1
- package/dist/temporal/file/activites.d.ts +1 -0
- package/dist/temporal/file/activites.js +5 -2
- package/dist/temporal/file/activites.js.map +1 -1
- package/dist/temporal/file/contrat.d.ts +50 -33
- package/dist/temporal/file/contrat.js +2 -2
- package/dist/temporal/file/contrat.js.map +1 -1
- package/dist/temporal/file/deroule.d.ts +3 -1
- package/dist/temporal/file/deroule.js +128 -26
- package/dist/temporal/file/deroule.js.map +1 -1
- package/dist/temporal/installation.d.ts +3 -2
- package/dist/temporal/installation.js +7 -4
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/nuits/activites.d.ts +10 -0
- package/dist/temporal/nuits/activites.js +114 -0
- package/dist/temporal/nuits/activites.js.map +1 -0
- package/dist/temporal/nuits/appel.d.ts +23 -0
- package/dist/temporal/nuits/appel.js +40 -0
- package/dist/temporal/nuits/appel.js.map +1 -0
- package/dist/temporal/nuits/choix.d.ts +14 -0
- package/dist/temporal/nuits/choix.js +119 -0
- package/dist/temporal/nuits/choix.js.map +1 -0
- package/dist/temporal/nuits/client.d.ts +28 -0
- package/dist/temporal/nuits/client.js +83 -0
- package/dist/temporal/nuits/client.js.map +1 -0
- package/dist/temporal/nuits/commande.d.ts +2 -0
- package/dist/temporal/nuits/commande.js +107 -0
- package/dist/temporal/nuits/commande.js.map +1 -0
- package/dist/temporal/nuits/contrat.d.ts +98 -0
- package/dist/temporal/nuits/contrat.js +30 -0
- package/dist/temporal/nuits/contrat.js.map +1 -0
- package/dist/temporal/nuits/deroule.d.ts +5 -0
- package/dist/temporal/nuits/deroule.js +100 -0
- package/dist/temporal/nuits/deroule.js.map +1 -0
- package/dist/temporal/tickets/activites.d.ts +1 -0
- package/dist/temporal/tickets/activites.js +5 -0
- package/dist/temporal/tickets/activites.js.map +1 -1
- package/dist/temporal/tickets/contrat.d.ts +10 -0
- package/dist/temporal/tickets/deroule.js +8 -1
- package/dist/temporal/tickets/deroule.js.map +1 -1
- package/dist/temporal/travailleur.js +4 -1
- package/dist/temporal/travailleur.js.map +1 -1
- package/docs/ARCHITECTURE.md +257 -54
- package/docs/CADRE.md +41 -1
- package/docs/INTERFACE.md +54 -7
- package/hooks/hooks.json +4 -0
- package/hooks/register.tsx +11 -3
- package/package.json +4 -1
- package/scripts/abi-des-dependances.mjs +105 -0
- package/scripts/activites.mjs +99 -48
- package/scripts/aiguillage.mjs +3 -0
- package/scripts/attente-au-tour.mjs +99 -0
- package/scripts/avancement.mjs +8 -18
- package/scripts/base-des-workflows.mjs +57 -0
- package/scripts/ci-des-branches.mjs +91 -0
- package/scripts/circuit.mjs +99 -5
- package/scripts/composants-affectes.mjs +24 -7
- package/scripts/composition-des-langages.mjs +3 -0
- package/scripts/copies-finies.mjs +8 -1
- package/scripts/crochets.mjs +4 -0
- package/scripts/dernier-vert.mjs +30 -4
- package/scripts/effets.mjs +9 -0
- package/scripts/enveloppe/enveloppe.mjs +3 -1
- package/scripts/enveloppe/lancer.sh +1 -1
- package/scripts/enveloppe/travail-de-la-copie.mjs +219 -59
- package/scripts/etapes.mjs +19 -2
- package/scripts/faits-du-circuit.mjs +43 -20
- package/scripts/fichier-du-poste.mjs +87 -0
- package/scripts/grillhouse-maj.mjs +15 -1
- package/scripts/integration/file.mjs +215 -275
- package/scripts/integration/integrer.mjs +82 -41
- package/scripts/integration/rejeu.mjs +13 -64
- package/scripts/jointure.d.ts +30 -2
- package/scripts/journal-des-etats.d.mts +41 -0
- package/scripts/journal-des-etats.mjs +273 -0
- package/scripts/journal.mjs +119 -0
- package/scripts/langages/cargo/commandes.mjs +81 -19
- package/scripts/langages/cargo/exemples.mjs +2 -2
- package/scripts/langages/cargo/index.mjs +14 -5
- package/scripts/langages/cargo/tailles-des-tests.mjs +19 -11
- package/scripts/langages/python/commandes.mjs +11 -7
- package/scripts/langages/python/exemples.mjs +1 -1
- package/scripts/langages/python/index.mjs +11 -2
- package/scripts/langages/python/tailles-des-tests.mjs +19 -11
- package/scripts/langages/typescript/code-mort.mjs +41 -24
- package/scripts/langages/typescript/consommateurs.mjs +28 -17
- package/scripts/langages/typescript/exemples.mjs +2 -0
- package/scripts/langages/typescript/frontieres.mjs +46 -0
- package/scripts/langages/typescript/index.mjs +24 -3
- package/scripts/langages/typescript/migrations/0.33.0-binaire-de-jour.mjs +34 -0
- package/scripts/langages/typescript/migrations/0.33.0-tests-du-poste.mjs +31 -0
- package/scripts/langages/typescript/resumes.mjs +17 -7
- package/scripts/langages/typescript/tailles-des-tests.mjs +251 -22
- package/scripts/langages/typescript/tests-de-nuit.mjs +101 -9
- package/scripts/langages/typescript/tests-du-poste.mjs +172 -0
- package/scripts/langages/typescript/tranches.mjs +273 -0
- package/scripts/langages/typescript/verifier.mjs +154 -23
- package/scripts/langages/typescript/vitest-config/base.mjs +3 -0
- package/scripts/langages/typescript/vitest-config/cibles.mjs +78 -7
- package/scripts/langages/typescript/vitest-config/lances.mjs +4 -4
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +9 -0
- package/scripts/langages/typescript/vitest.nuit.config.mjs +3 -2
- package/scripts/langages.d.mts +20 -0
- package/scripts/lint-des-scripts.mjs +23 -6
- package/scripts/matiere-de-test.d.ts +11 -0
- package/scripts/migrations/0.33.0-cache-distant.mjs +36 -0
- package/scripts/migrations/0.33.0-ci-des-branches-de-ticket.mjs +31 -0
- package/scripts/migrations/0.33.0-ci-du-cadre.mjs +31 -0
- package/scripts/migrations/0.33.0-node-26.mjs +58 -0
- package/scripts/migrations.mjs +8 -0
- package/scripts/newday.mjs +18 -0
- package/scripts/nuit.sh +40 -13
- package/scripts/places-de-la-machine.mjs +6 -0
- package/scripts/registre.d.mts +90 -0
- package/scripts/registre.mjs +28 -3
- package/scripts/reprise.mjs +12 -8
- package/scripts/services-du-noyau.mjs +4 -0
- package/scripts/session-start.sh +28 -32
- package/scripts/sous-commandes.mjs +31 -10
- package/scripts/superviseur.mjs +127 -75
- package/scripts/tableau.mjs +222 -17
- package/scripts/taches-du-graphe.mjs +39 -6
- package/scripts/ticket-du-circuit.mjs +37 -7
- package/scripts/transitions.mjs +60 -8
- package/scripts/verrou-de-machine.mjs +1 -2
- package/scripts/workflows-du-cadre.mjs +75 -0
- package/skills/developpeur/SKILL.md +1 -1
- package/skills/explorateur/SKILL.md +1 -1
- package/skills/grill/SKILL.md +10 -62
- package/skills/grill/references/paquets.md +60 -0
- package/skills/pitmaster/SKILL.md +21 -31
- package/skills/questionneur/SKILL.md +1 -1
- package/skills/relecteur/SKILL.md +1 -1
- package/skills/testwriter/SKILL.md +7 -1
- package/skills/release/SKILL.md +0 -134
- package/skills/release/scripts/update-version.cjs +0 -92
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// From 0.33.0 the guard of the sizes of the tests (scripts/langages/typescript/tailles-des-tests.mjs)
|
|
2
|
+
// also refuses a test of the day that starts the frame's command (its binary, or a script of its
|
|
3
|
+
// `bin/` or `scripts/`) out of the zone of the end-to-end tests (a directory `e2e/`): a test of
|
|
4
|
+
// the day validates the code by importing it. A project whose tests start it would turn red at its
|
|
5
|
+
// next pass; as the migration 0.30.0 does for the heavy tools, the update inscribes them as the
|
|
6
|
+
// project's known debt (scripts/dette.mjs), frozen: the count never rises and a new one is refused.
|
|
7
|
+
//
|
|
8
|
+
// - The migration inscribes the findings of the guard that the debt does not hold yet; the debt
|
|
9
|
+
// already inscribed (the guard's, the other guards') stays.
|
|
10
|
+
// - It rewrites no test of the project: the project makes each one import what it proves, or moves
|
|
11
|
+
// it under a directory `e2e/`, and the debt comes down with it.
|
|
12
|
+
// - Replayable without effect: once every finding is inscribed, nothing.
|
|
13
|
+
import { FICHIER, lire, trancher } from '../../../dette.mjs';
|
|
14
|
+
import { BINAIRE_DE_JOUR, GARDE, verifier } from '../tailles-des-tests.mjs';
|
|
15
|
+
|
|
16
|
+
export const version = '0.33.0';
|
|
17
|
+
export const nom = 'binaire de jour';
|
|
18
|
+
|
|
19
|
+
/** Inscribes the tests of the day that start the frame's command the debt of <projet> lacks. */
|
|
20
|
+
export function migrer(projet) {
|
|
21
|
+
const inscrite = lire(projet)[GARDE] ?? {};
|
|
22
|
+
const constats = verifier(projet);
|
|
23
|
+
const neufs = constats.filter(
|
|
24
|
+
c => c.regle === BINAIRE_DE_JOUR && !inscrite[c.fichier]?.[c.regle]
|
|
25
|
+
);
|
|
26
|
+
if (neufs.length === 0) {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
// Inscribed counts stay; a finding without key is added at its count.
|
|
30
|
+
trancher(projet, GARDE, constats, 'inscrire', {});
|
|
31
|
+
return [
|
|
32
|
+
`${FICHIER} : ${neufs.length} test(s) de jour qui lance(nt) la commande grillhouse inscrit(s) dans la dette de ${GARDE}, gelée ; un neuf est refusé, et chacun importe ce qu'il prouve ou passe sous un dossier e2e/`,
|
|
33
|
+
];
|
|
34
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// From 0.33.0 the guard of the night tests of the poste (scripts/langages/typescript/tests-du-poste.mjs)
|
|
2
|
+
// refuses a night test that depends on the poste (the envelope, the real bd, a Temporal server,
|
|
3
|
+
// sccache, systemd, the keyring, the user's session, a session of claude) without the tag `@poste`
|
|
4
|
+
// at its head. A project whose night tests depend on it would turn red at its next pass; as the
|
|
5
|
+
// migration of the tests that start the frame's command does, the update inscribes them as the
|
|
6
|
+
// project's known debt (scripts/dette.mjs), frozen: the count never rises and a new one is refused.
|
|
7
|
+
//
|
|
8
|
+
// - The migration inscribes the findings of the guard that the debt does not hold yet; the debt
|
|
9
|
+
// already inscribed (the guard's, the other guards') stays.
|
|
10
|
+
// - It rewrites no test of the project: the project tags each one (`// @poste: <raison>` at its
|
|
11
|
+
// head), and the debt comes down with it.
|
|
12
|
+
// - Replayable without effect: once every finding is inscribed, nothing.
|
|
13
|
+
import { FICHIER, lire, trancher } from '../../../dette.mjs';
|
|
14
|
+
import { GARDE, verifier } from '../tests-du-poste.mjs';
|
|
15
|
+
|
|
16
|
+
export const version = '0.33.0';
|
|
17
|
+
export const nom = 'tests du poste';
|
|
18
|
+
|
|
19
|
+
/** Inscribes the night tests of the poste without the tag that the debt of <projet> lacks. */
|
|
20
|
+
export function migrer(projet) {
|
|
21
|
+
const inscrite = lire(projet)[GARDE] ?? {};
|
|
22
|
+
const constats = verifier(projet);
|
|
23
|
+
const neufs = constats.filter(c => !inscrite[c.fichier]?.[c.regle]);
|
|
24
|
+
if (neufs.length === 0) {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
trancher(projet, GARDE, constats, 'inscrire', {});
|
|
28
|
+
return [
|
|
29
|
+
`${FICHIER} : ${neufs.length} test(s) de nuit qui dépend(ent) du poste sans l'étiquette @poste inscrit(s) dans la dette de ${GARDE}, gelée ; un neuf est refusé, et chacun porte « // @poste: <raison> » en tête`,
|
|
30
|
+
];
|
|
31
|
+
}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
import { existsSync, readFileSync } from 'node:fs';
|
|
20
20
|
import path from 'node:path';
|
|
21
21
|
import { pathToFileURL } from 'node:url';
|
|
22
|
-
import { trancher } from '../../dette.mjs';
|
|
22
|
+
import { MODE, trancher } from '../../dette.mjs';
|
|
23
23
|
import { lire } from './index-interfaces.mjs';
|
|
24
24
|
import { aVerifier } from './interfaces-contre-code.mjs';
|
|
25
25
|
|
|
@@ -50,14 +50,24 @@ export function verifier(racine, env = process.env) {
|
|
|
50
50
|
return constats;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
// The report of the check at <racine>: `lignes`, what the command writes on stderr (each refusal
|
|
54
|
+
// prefixed with `⛔`, then the debt's lines), and `code`, its exit code (1 on a refusal). The
|
|
55
|
+
// functional core of the command: it reads the repository and the project's debt and writes nothing
|
|
56
|
+
// to the standard streams; the command below is its shell. The refusals reach SARIF through
|
|
57
|
+
// `trancher` under the results directory <env> names (scripts/resultats.mjs); without it none is
|
|
58
|
+
// written, and the debt's mode is <env>'s `GRILLHOUSE_DETTE`.
|
|
59
|
+
export function rapport(racine, env = process.env) {
|
|
60
|
+
const { refus, lignes } = trancher(racine, 'resumes', verifier(racine, env), env[MODE] || undefined, env);
|
|
61
|
+
return {
|
|
62
|
+
lignes: [...refus.map(r => `⛔ ${r.message}`), ...lignes],
|
|
63
|
+
code: refus.length ? 1 : 0,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
53
67
|
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
54
|
-
const
|
|
55
|
-
const { refus, lignes } = trancher(racine, 'resumes', verifier(racine));
|
|
56
|
-
for (const r of refus) {
|
|
57
|
-
process.stderr.write(`⛔ ${r.message}\n`);
|
|
58
|
-
}
|
|
68
|
+
const { lignes, code } = rapport(process.cwd());
|
|
59
69
|
for (const l of lignes) {
|
|
60
70
|
process.stderr.write(`${l}\n`);
|
|
61
71
|
}
|
|
62
|
-
process.exitCode =
|
|
72
|
+
process.exitCode = code;
|
|
63
73
|
}
|
|
@@ -36,15 +36,33 @@
|
|
|
36
36
|
// inscribed in the project's debt (`grillhouse-dette.json`, ./dette.mjs) passes: the large tests
|
|
37
37
|
// of the day that exist when the rule arrives are inscribed there by the update
|
|
38
38
|
// (./migrations/0.25.0-tailles-des-tests.mjs), the count never rises, and a new one is refused.
|
|
39
|
+
// - A test of the day validates the code by importing it: one that starts the frame's command
|
|
40
|
+
// (`lanceLeCadre`) is a finding, `{ fichier, regle: 'binaire-de-jour', message }`, out of the zone
|
|
41
|
+
// of the end-to-end tests: a directory `e2e/` at any depth (as Playwright's and Angular's `e2e/`,
|
|
42
|
+
// Cypress's `cypress/e2e/`), or a package of PAQUETS_DE_BOUT_EN_BOUT (`grillhouse-essais`, as a
|
|
43
|
+
// project `<app>-e2e` of Nx). The reading sees a process call (APPEL; git's left out) whose first
|
|
44
|
+
// argument is `'grillhouse'` (or `'npx'` then `'grillhouse'`), or that writes a string naming the
|
|
45
|
+
// command (`node_modules/.bin/grillhouse`, `bin/grillhouse.mjs`, a line `npx grillhouse <x>`) or
|
|
46
|
+
// a file of `bin/` or `scripts/` of the frame's package (`cadreDe`, resolved from the file's
|
|
47
|
+
// directory, its package, the root): a script of the frame is the code of its subcommand. A name
|
|
48
|
+
// counts when its initializer is a path naming it so (`const BIN = path.resolve(…)`), or another
|
|
49
|
+
// such name, in the test or its material. A path built at run time (`path.join(SCRIPTS, nom)`),
|
|
50
|
+
// a launcher passed through a helper without the name in the call, and the code of a `node -e`
|
|
51
|
+
// (a template with a substitution) escape the reading. The cases that exist when the rule
|
|
52
|
+
// arrives are inscribed by the update (./migrations/0.33.0-binaire-de-jour.mjs).
|
|
39
53
|
// - The guard writes on its error stream the count of each size, the night's included.
|
|
40
54
|
import { spawnSync } from 'node:child_process';
|
|
41
|
-
import { globSync, readFileSync } from 'node:fs';
|
|
55
|
+
import { existsSync, globSync, readFileSync, realpathSync, statSync } from 'node:fs';
|
|
56
|
+
import { createRequire } from 'node:module';
|
|
42
57
|
import path from 'node:path';
|
|
43
58
|
import { pathToFileURL } from 'node:url';
|
|
44
59
|
import { trancher } from '../../dette.mjs';
|
|
60
|
+
import { paquets } from '../../paquets.mjs';
|
|
45
61
|
import { matieres } from './composants.mjs';
|
|
46
62
|
import { deNuitOuBanc } from './vitest-config/cibles.mjs';
|
|
47
63
|
import {
|
|
64
|
+
chaines,
|
|
65
|
+
code,
|
|
48
66
|
IMPORT,
|
|
49
67
|
lireLeDisque,
|
|
50
68
|
MATIERE,
|
|
@@ -54,6 +72,7 @@ import {
|
|
|
54
72
|
|
|
55
73
|
export const GARDE = 'tailles-des-tests';
|
|
56
74
|
export const GRAND_DE_JOUR = 'grand-de-jour';
|
|
75
|
+
export const BINAIRE_DE_JOUR = 'binaire-de-jour';
|
|
57
76
|
|
|
58
77
|
// The import of a way to start a process.
|
|
59
78
|
const PROCESSUS = /['"](?:node:)?child_process['"]|['"]execa['"]|['"]zx['"]/;
|
|
@@ -149,20 +168,211 @@ export function lesMatieres(racine) {
|
|
|
149
168
|
});
|
|
150
169
|
}
|
|
151
170
|
|
|
171
|
+
/** The package of the frame, whose command a test of the day does not start. */
|
|
172
|
+
export const PAQUET_DU_CADRE = '@roomi-fields/grillhouse';
|
|
173
|
+
/** The packages of end-to-end tests by design: they start the frame's scripts and import none. */
|
|
174
|
+
export const PAQUETS_DE_BOUT_EN_BOUT = ['@roomi-fields/grillhouse-essais'];
|
|
175
|
+
// The directory of the end-to-end tests, at any depth (`tests/e2e/`), as Playwright's and
|
|
176
|
+
// Angular's `e2e/` and Cypress's `cypress/e2e/`.
|
|
177
|
+
const ZONE_E2E = /(?:^|\/)e2e\//;
|
|
178
|
+
// A string that names the frame's command: its link, its file, or a command line.
|
|
179
|
+
const COMMANDE_DU_CADRE =
|
|
180
|
+
/(?:^|[\s/'"])(?:\.bin\/grillhouse|bin\/grillhouse\.mjs)(?=$|[\s'"])|^(?:npx\s+(?:-\S+\s+)*)?grillhouse\s+[a-z]/;
|
|
181
|
+
// A literal first argument of a call: `'grillhouse'`, or `'npx'` whose arguments name it.
|
|
182
|
+
const PREMIER_GRILLHOUSE = /^['"`]grillhouse['"`]$/;
|
|
183
|
+
const PREMIER_NPX = /^['"`]npx['"`]$/;
|
|
184
|
+
// A path a string may write, resolved from the directory of its file.
|
|
185
|
+
const CHEMIN = /^[\w@.][\w@./-]*$/;
|
|
186
|
+
// An initializer that writes a path or a command: a string, an array, a join or a resolution of
|
|
187
|
+
// paths, a URL, another name (alone, or a choice between names); a value computed from it (a
|
|
188
|
+
// process's result, a file's text, a function, a trial project) is none.
|
|
189
|
+
const VALEUR_DE_CHEMIN =
|
|
190
|
+
/^\s*(?:['"`[]|(?:path\.)?(?:join|resolve)\(|fileURLToPath\(|new\s+URL\(|[\w$.]+\s*(?:$|\?|\|\|))/;
|
|
191
|
+
// A template that substitutes a value: the code of `node -e`, a shell line built at run time.
|
|
192
|
+
const GABARIT = /`(?:[^`\\]|\\.)*\$\{(?:[^`\\]|\\.)*`/g;
|
|
193
|
+
// A declaration of a name and the start of its initializer.
|
|
194
|
+
const DECLARATION = /\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=(?!=)/g;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* The directory of the frame's package for the repository at <racine>: the package of its
|
|
198
|
+
* workspace of that name (in Grillhouse, `packages/grillhouse`), else the one Node resolves from
|
|
199
|
+
* it, by its real path; null when the repository does not install it.
|
|
200
|
+
*/
|
|
201
|
+
export function cadreDe(racine) {
|
|
202
|
+
const ici = paquets(racine).find(p => p.pkg?.name === PAQUET_DU_CADRE);
|
|
203
|
+
if (ici) {
|
|
204
|
+
return path.join(racine, ici.dossier);
|
|
205
|
+
}
|
|
206
|
+
try {
|
|
207
|
+
const pkg = createRequire(path.join(racine, 'package.json')).resolve(
|
|
208
|
+
`${PAQUET_DU_CADRE}/package.json`
|
|
209
|
+
);
|
|
210
|
+
return path.dirname(realpathSync(pkg));
|
|
211
|
+
} catch {
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// The initializer of the declaration whose `=` ends at <debut> of <texte>: to its `;` or its end of
|
|
217
|
+
// line at depth 0.
|
|
218
|
+
function initialiseur(texte, debut) {
|
|
219
|
+
let profondeur = 0;
|
|
220
|
+
const fin = Math.min(texte.length, debut + 2000);
|
|
221
|
+
for (let i = debut; i < fin; i++) {
|
|
222
|
+
const c = texte[i];
|
|
223
|
+
if (c === '(' || c === '[' || c === '{') {
|
|
224
|
+
profondeur++;
|
|
225
|
+
} else if (c === ')' || c === ']' || c === '}') {
|
|
226
|
+
if (--profondeur < 0) {
|
|
227
|
+
return texte.slice(debut, i);
|
|
228
|
+
}
|
|
229
|
+
} else if ((c === ';' || c === '\n') && profondeur === 0) {
|
|
230
|
+
return texte.slice(debut, i);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return texte.slice(debut, fin);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// The directory of the package that holds <f> under <racine>: the nearest holding a package.json
|
|
237
|
+
// <lire> reads, else <racine>.
|
|
238
|
+
function paquetDe(f, lire, racine) {
|
|
239
|
+
for (
|
|
240
|
+
let d = path.dirname(f);
|
|
241
|
+
d.startsWith(racine) && d !== path.dirname(d);
|
|
242
|
+
d = path.dirname(d)
|
|
243
|
+
) {
|
|
244
|
+
if (lire(path.join(d, 'package.json')) !== null) {
|
|
245
|
+
return d;
|
|
246
|
+
}
|
|
247
|
+
if (d === racine) {
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return racine;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// Whether the string <s> names the frame's command, or a file under `bin/` or `scripts/` of the
|
|
255
|
+
// frame's package at <cadre>, resolved from one of <bases>.
|
|
256
|
+
function nommeLeCadre(s, bases, cadre) {
|
|
257
|
+
if (COMMANDE_DU_CADRE.test(s)) {
|
|
258
|
+
return true;
|
|
259
|
+
}
|
|
260
|
+
if (!cadre || !CHEMIN.test(s)) {
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
return bases.some(b => {
|
|
264
|
+
const c = path.resolve(b, s);
|
|
265
|
+
const cle = `${cadre}\0${c}`;
|
|
266
|
+
if (!duCadre.has(cle)) {
|
|
267
|
+
duCadre.set(cle, fichierDuCadre(c, cadre));
|
|
268
|
+
}
|
|
269
|
+
return duCadre.get(cle);
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
// Whether the path <c> is a file under `bin/` or `scripts/` of the frame's package at <cadre>,
|
|
273
|
+
// each path read once per process.
|
|
274
|
+
const duCadre = new Map();
|
|
275
|
+
function fichierDuCadre(c, cadre) {
|
|
276
|
+
try {
|
|
277
|
+
if (!existsSync(c) || !statSync(c).isFile()) {
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
const r = path.relative(cadre, realpathSync(c)).split(path.sep);
|
|
281
|
+
return r[0] === 'bin' || r[0] === 'scripts';
|
|
282
|
+
} catch {
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Whether the texts <sources> (`[{ f, texte }]`: a test file and its test material) start the
|
|
289
|
+
* frame's command: a process call whose first argument is `'grillhouse'` (or `'npx'` then
|
|
290
|
+
* `'grillhouse'`), or that writes a string naming it (its link, `bin/grillhouse.mjs`, a line
|
|
291
|
+
* `npx grillhouse <x>`, a file of `bin/` or `scripts/` of the frame's package at <cadre>), or a name
|
|
292
|
+
* whose initializer does, in one of the texts. <lire> reads a file, <racine> is the repository.
|
|
293
|
+
*/
|
|
294
|
+
export function lanceLeCadre(sources, lire, racine, cadre = null) {
|
|
295
|
+
const lus = sources.map(({ f, texte }) => ({
|
|
296
|
+
f,
|
|
297
|
+
code: code(texte),
|
|
298
|
+
bases: [path.dirname(f), paquetDe(f, lire, racine), racine],
|
|
299
|
+
}));
|
|
300
|
+
// The names whose initializer is a path or a command naming the frame, or a name already
|
|
301
|
+
// marked, to a fixed point.
|
|
302
|
+
const marques = new Set();
|
|
303
|
+
const declarations = lus.flatMap(({ code: c, bases }) =>
|
|
304
|
+
[...c.matchAll(DECLARATION)]
|
|
305
|
+
.map(m => ({ nom: m[1], init: initialiseur(c, m.index + m[0].length), bases }))
|
|
306
|
+
.filter(d => VALEUR_DE_CHEMIN.test(d.init))
|
|
307
|
+
);
|
|
308
|
+
const reference = (texte, nom) =>
|
|
309
|
+
new RegExp(`(?<![\\w$.])${nom.replaceAll('$', '\\$')}(?![\\w$])`).test(texte);
|
|
310
|
+
const nomme = (texte, bases) =>
|
|
311
|
+
chaines(texte).some(s => nommeLeCadre(s, bases, cadre)) ||
|
|
312
|
+
[...marques].some(n => reference(texte, n));
|
|
313
|
+
for (let change = true; change;) {
|
|
314
|
+
change = false;
|
|
315
|
+
for (const d of declarations) {
|
|
316
|
+
if (!marques.has(d.nom) && nomme(d.init, d.bases)) {
|
|
317
|
+
marques.add(d.nom);
|
|
318
|
+
change = true;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return lus.some(({ code: c, bases }) =>
|
|
323
|
+
[...c.matchAll(APPEL)].some(m => {
|
|
324
|
+
const premier = m[1].trim();
|
|
325
|
+
if (GIT.test(premier)) {
|
|
326
|
+
return false;
|
|
327
|
+
}
|
|
328
|
+
const appel = appelComplet(c, m.index + m[0].indexOf('(')).replace(GABARIT, '``');
|
|
329
|
+
return (
|
|
330
|
+
PREMIER_GRILLHOUSE.test(premier) ||
|
|
331
|
+
(PREMIER_NPX.test(premier) && chaines(appel).includes('grillhouse')) ||
|
|
332
|
+
nomme(appel, bases)
|
|
333
|
+
);
|
|
334
|
+
})
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// Whether the test <fichier> (from the top of <racine>) lies in the zone of the end-to-end tests:
|
|
339
|
+
// under a directory `e2e/`, or in a package of PAQUETS_DE_BOUT_EN_BOUT.
|
|
340
|
+
function dansLaZone(fichier, racine) {
|
|
341
|
+
if (ZONE_E2E.test(fichier)) {
|
|
342
|
+
return true;
|
|
343
|
+
}
|
|
344
|
+
const d = paquetDe(path.join(racine, fichier), lireLeDisque, racine);
|
|
345
|
+
try {
|
|
346
|
+
return PAQUETS_DE_BOUT_EN_BOUT.includes(
|
|
347
|
+
JSON.parse(readFileSync(path.join(d, 'package.json'), 'utf8')).name
|
|
348
|
+
);
|
|
349
|
+
} catch {
|
|
350
|
+
return false;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
152
354
|
/**
|
|
153
355
|
* The size of the test file <fichier> (absolute), read by <lire> (a path → its text, null when it
|
|
154
356
|
* does not read), in the repository at <racine>, whose packages of the shared test material are
|
|
155
|
-
* <lesMatieres> (`[{ nom, dir, entree }]`, absolute paths)
|
|
156
|
-
*
|
|
157
|
-
* followed, not counted)
|
|
357
|
+
* <lesMatieres> (`[{ nom, dir, entree }]`, absolute paths), the frame's package at <cadre> (null
|
|
358
|
+
* when not installed): `{ taille, modules, lance }`, `taille` one of `petit`, `moyen`, `grand`,
|
|
359
|
+
* `modules` the modules of the repository it imports (the test material followed, not counted),
|
|
360
|
+
* `lance` whether it starts the frame's command (`lanceLeCadre`).
|
|
158
361
|
*/
|
|
159
|
-
export function classer(
|
|
362
|
+
export function classer(
|
|
363
|
+
fichier,
|
|
364
|
+
lire,
|
|
365
|
+
racine = path.parse(fichier).root,
|
|
366
|
+
lesMatieres = [],
|
|
367
|
+
cadre = null
|
|
368
|
+
) {
|
|
160
369
|
const dansUneMatiere = f =>
|
|
161
370
|
lesMatieres.some(m => {
|
|
162
371
|
const r = path.relative(m.dir, f);
|
|
163
372
|
return r !== '' && !r.startsWith('..') && !path.isAbsolute(r);
|
|
164
373
|
});
|
|
165
374
|
const textes = [];
|
|
375
|
+
const sources = [];
|
|
166
376
|
const modules = new Set();
|
|
167
377
|
const vus = new Set();
|
|
168
378
|
// <f> followed; with <noms>, the names a test imports of it, its re-exports of a whole module
|
|
@@ -178,6 +388,7 @@ export function classer(fichier, lire, racine = path.parse(fichier).root, lesMat
|
|
|
178
388
|
const texte = lire(f) ?? '';
|
|
179
389
|
if (!lus.has(f)) {
|
|
180
390
|
textes.push(texte);
|
|
391
|
+
sources.push({ f, texte });
|
|
181
392
|
}
|
|
182
393
|
lus.add(f);
|
|
183
394
|
// The server counts when the part of the file the test takes starts it: the whole file for
|
|
@@ -227,7 +438,11 @@ export function classer(fichier, lire, racine = path.parse(fichier).root, lesMat
|
|
|
227
438
|
: processus || modules.size > 1
|
|
228
439
|
? 'moyen'
|
|
229
440
|
: 'petit';
|
|
230
|
-
return {
|
|
441
|
+
return {
|
|
442
|
+
taille,
|
|
443
|
+
modules: [...modules],
|
|
444
|
+
lance: processus && lanceLeCadre(sources, lire, racine, cadre),
|
|
445
|
+
};
|
|
231
446
|
}
|
|
232
447
|
|
|
233
448
|
// The directories a listing out of git leaves out.
|
|
@@ -249,28 +464,42 @@ export function testsDuDepot(racine) {
|
|
|
249
464
|
return [...new Set(fichiers.filter(f => TEST.test(f)))].sort();
|
|
250
465
|
}
|
|
251
466
|
|
|
252
|
-
/**
|
|
467
|
+
/**
|
|
468
|
+
* Each test file of the repository at <racine> and its size: `[{ fichier, taille, nuit, lance }]`,
|
|
469
|
+
* `lance` whether it starts the frame's command.
|
|
470
|
+
*/
|
|
253
471
|
export function tailles(racine) {
|
|
254
472
|
const m = lesMatieres(racine);
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
taille
|
|
258
|
-
nuit: deNuitOuBanc(fichier),
|
|
259
|
-
})
|
|
473
|
+
const cadre = cadreDe(racine);
|
|
474
|
+
return testsDuDepot(racine).map(fichier => {
|
|
475
|
+
const { taille, lance } = classer(path.join(racine, fichier), lireLeDisque, racine, m, cadre);
|
|
476
|
+
return { fichier, taille, nuit: deNuitOuBanc(fichier), lance };
|
|
477
|
+
});
|
|
260
478
|
}
|
|
261
479
|
|
|
262
480
|
/**
|
|
263
|
-
* The findings of the repository at <racine
|
|
264
|
-
* the day,
|
|
481
|
+
* The findings of the repository at <racine>, in the debt's form (./dette.mjs): one
|
|
482
|
+
* `{ fichier, regle, message }` per large test of the day (`grand-de-jour`), and per test of the
|
|
483
|
+
* day out of the zone of the end-to-end tests that starts the frame's command (`binaire-de-jour`).
|
|
265
484
|
*/
|
|
266
485
|
export function verifier(racine) {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
486
|
+
const toutes = tailles(racine);
|
|
487
|
+
return [
|
|
488
|
+
...toutes
|
|
489
|
+
.filter(t => t.taille === 'grand' && !t.nuit)
|
|
490
|
+
.map(({ fichier }) => ({
|
|
491
|
+
fichier,
|
|
492
|
+
regle: GRAND_DE_JOUR,
|
|
493
|
+
message: `${fichier} : un grand test (il monte un dépôt ou un projet d'essai et y lance le produit ou le cadre) est un test de nuit, jamais joué au fil du travail ; il se renomme en *.nuit.test.*, ou il se réduit à la plus petite taille qui prouve son critère.`,
|
|
494
|
+
})),
|
|
495
|
+
...toutes
|
|
496
|
+
.filter(t => t.lance && !t.nuit && !dansLaZone(t.fichier, racine))
|
|
497
|
+
.map(({ fichier }) => ({
|
|
498
|
+
fichier,
|
|
499
|
+
regle: BINAIRE_DE_JOUR,
|
|
500
|
+
message: `${fichier} : un test de jour valide le code en l'important ; il lance ici la commande grillhouse (son binaire, ou un script de bin/ ou scripts/ du cadre). Il importe la fonction qu'il prouve, ou, s'il est un vrai test de bout-en-bout, il va sous un dossier e2e/.`,
|
|
501
|
+
})),
|
|
502
|
+
];
|
|
274
503
|
}
|
|
275
504
|
|
|
276
505
|
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
@@ -286,7 +515,7 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
|
286
515
|
process.stderr.write(`${l}\n`);
|
|
287
516
|
}
|
|
288
517
|
process.stderr.write(
|
|
289
|
-
`ℹ️ ${GARDE} : ${toutes.length} fichier(s) de tests, ${compte('petit')} petit(s), ${compte('moyen')} moyen(s), ${compte('grand')} grand(s) ; ${nuit} de nuit ou de banc.\n`
|
|
518
|
+
`ℹ️ ${GARDE} : ${toutes.length} fichier(s) de tests, ${compte('petit')} petit(s), ${compte('moyen')} moyen(s), ${compte('grand')} grand(s) ; ${nuit} de nuit ou de banc ; ${toutes.filter(x => x.lance).length} lance(nt) la commande grillhouse.\n`
|
|
290
519
|
);
|
|
291
520
|
process.exitCode = refus.length ? 1 : 0;
|
|
292
521
|
}
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
// (scripts/jointure.d.ts), which the night (scripts/nuit.sh) runs in its copy after the full pass,
|
|
4
4
|
// through its mounts.
|
|
5
5
|
//
|
|
6
|
-
// node tests-de-nuit.mjs
|
|
6
|
+
// node tests-de-nuit.mjs from the root of the copy: the night of the poste
|
|
7
|
+
// node tests-de-nuit.mjs --hors-du-poste the night of a shared machine (a CI runner)
|
|
8
|
+
// node tests-de-nuit.mjs --hors-du-poste --tranche i/n its tranche i of n
|
|
7
9
|
//
|
|
8
10
|
// - The files `*.nuit.test.*` and `*.nuit.spec.*` of the copy, outside node_modules, dist and
|
|
9
11
|
// .git, the night tests, then its measures of time, the time budget benches (`*.budget.test.*`,
|
|
@@ -16,22 +18,74 @@
|
|
|
16
18
|
// time (GRILLHOUSE_TESTS_DE_NUIT=mesures), as Bazel plays a test tagged `exclusive` after the
|
|
17
19
|
// others, nothing beside it, and as the module cargo plays its benches after its night tests
|
|
18
20
|
// (grillhouse-bd7). Each run plays when the copy holds its files.
|
|
21
|
+
// - With `--hors-du-poste`, the night of a shared machine: the night tests alone, but those that
|
|
22
|
+
// bear the tag `@poste` (`porteLEtiquetteDuPoste` of ./vitest-config/cibles.mjs, which the guard
|
|
23
|
+
// ./tests-du-poste.mjs asks of a night test that depends on the poste), in one run
|
|
24
|
+
// (GRILLHOUSE_TESTS_DE_NUIT=hors-poste), and no measure of time: a shared machine does not measure
|
|
25
|
+
// a time (the frame's charter, « Une mesure de temps joue la nuit »). It keeps no last green, as
|
|
26
|
+
// the night of the poste alone does (scripts/nuit.sh).
|
|
27
|
+
// - With `--tranche i/n` (or `--tranche=i/n`) beside `--hors-du-poste`, the i-th of n parts of
|
|
28
|
+
// those files, Vitest's split (`--shard`), as a tranche of the verification
|
|
29
|
+
// (`npm run verifier -- --tranche i/n`, ./tranches.mjs): it writes its blob report and the files
|
|
30
|
+
// of its part under `.vitest-reports/` (the reports of an earlier run of the same tranche
|
|
31
|
+
// removed), which `grillhouse fusion-des-tranches` controls and merges once the n tranches played:
|
|
32
|
+
// the n tranches together play each night test out of the poste once. The variable
|
|
33
|
+
// GRILLHOUSE_TRANCHE_DE_NUIT carries it to the night's configuration.
|
|
34
|
+
// - A tranche not of the form `i/n` (1 ≤ i ≤ n), a tranche without `--hors-du-poste` (the night of
|
|
35
|
+
// the poste plays whole), and any other argument are refused before any work, exit 2.
|
|
19
36
|
// - The exit code: 0 when every run is green; 75, « à repasser », when every red run is at 75
|
|
20
37
|
// (every failure depended on a duration, one under load, ./vitest-config/duree.reporter.mjs);
|
|
21
38
|
// else the code of the first red run.
|
|
22
39
|
// - They play once the temporary directory has room, as every heavy pass
|
|
23
40
|
// (`attendreDeLaPlace` of scripts/verrou-de-machine.mjs): a wait that reaches its bound ends at 75.
|
|
24
41
|
import { spawnSync } from 'node:child_process';
|
|
25
|
-
import { readdirSync } from 'node:fs';
|
|
42
|
+
import { readdirSync, rmSync } from 'node:fs';
|
|
26
43
|
import path from 'node:path';
|
|
27
44
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
28
|
-
import {
|
|
45
|
+
import {
|
|
46
|
+
A_REPASSER,
|
|
47
|
+
attendreDeLaPlace,
|
|
48
|
+
LA_FORME,
|
|
49
|
+
lireLaTranche,
|
|
50
|
+
} from '../../services-du-noyau.mjs';
|
|
29
51
|
import {
|
|
30
52
|
estUnBanc,
|
|
31
53
|
estUnTestDeNuit,
|
|
32
54
|
fichiersTemoins,
|
|
55
|
+
NUIT_TRANCHE,
|
|
33
56
|
NUIT_VARIABLE,
|
|
34
57
|
} from './vitest-config/cibles.mjs';
|
|
58
|
+
import { fichiersDeLaTranche, RAPPORTS } from './tranches.mjs';
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The options of the arguments <args>: `{ horsDuPoste, tranche, erreur }`, `tranche`
|
|
62
|
+
* `{ index, count }` or undefined, `erreur` the line that refuses them, or undefined.
|
|
63
|
+
* @param {string[]} args
|
|
64
|
+
*/
|
|
65
|
+
export function lireLesArguments(args) {
|
|
66
|
+
let horsDuPoste = false;
|
|
67
|
+
let texte;
|
|
68
|
+
for (let i = 0; i < args.length; i++) {
|
|
69
|
+
const a = args[i];
|
|
70
|
+
if (a === '--hors-du-poste') {
|
|
71
|
+
horsDuPoste = true;
|
|
72
|
+
} else if (a === '--tranche') {
|
|
73
|
+
texte = args[++i] ?? '';
|
|
74
|
+
} else if (a.startsWith('--tranche=')) {
|
|
75
|
+
texte = a.slice('--tranche='.length);
|
|
76
|
+
} else {
|
|
77
|
+
return { horsDuPoste, erreur: `⛔ tests-de-nuit : argument inconnu « ${a} » (usage : tests-de-nuit [--hors-du-poste [--tranche ${LA_FORME}]]).` };
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const tranche = texte === undefined ? undefined : (lireLaTranche(texte) ?? undefined);
|
|
81
|
+
if (texte !== undefined && !tranche) {
|
|
82
|
+
return { horsDuPoste, erreur: `⛔ --tranche attend la forme ${LA_FORME}, deux entiers avec 1 ≤ i ≤ n (par exemple --tranche 1/3) : « ${texte} » ne l'a pas.` };
|
|
83
|
+
}
|
|
84
|
+
if (tranche && !horsDuPoste) {
|
|
85
|
+
return { horsDuPoste, erreur: '⛔ --tranche découpe la nuit d\'une machine partagée : elle se donne avec --hors-du-poste ; la nuit du poste se joue entière.' };
|
|
86
|
+
}
|
|
87
|
+
return { horsDuPoste, tranche };
|
|
88
|
+
}
|
|
35
89
|
|
|
36
90
|
const CONFIGURATION = fileURLToPath(new URL('./vitest.nuit.config.mjs', import.meta.url));
|
|
37
91
|
const HORS = new Set(['node_modules', 'dist', '.git']);
|
|
@@ -51,15 +105,33 @@ function enTient(dossier, est) {
|
|
|
51
105
|
}
|
|
52
106
|
|
|
53
107
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
108
|
+
* The runs of Vitest the night plays in the copy at <racine>, each a value of
|
|
109
|
+
* GRILLHOUSE_TESTS_DE_NUIT, in their order: `nuit` when it holds night tests, then `mesures` when it
|
|
110
|
+
* holds a bench or a time witness; with <horsDuPoste>, `hors-poste` alone when it holds night tests.
|
|
56
111
|
* @param {string} racine the root of the copy
|
|
112
|
+
* @param {{ horsDuPoste?: boolean }} [options] the night of a shared machine
|
|
113
|
+
* @returns {string[]}
|
|
57
114
|
*/
|
|
58
|
-
export function
|
|
59
|
-
|
|
115
|
+
export function runsDeLaNuit(racine, { horsDuPoste = false } = {}) {
|
|
116
|
+
if (horsDuPoste) {
|
|
117
|
+
return enTient(racine, estUnTestDeNuit) ? ['hors-poste'] : [];
|
|
118
|
+
}
|
|
119
|
+
return [
|
|
60
120
|
enTient(racine, estUnTestDeNuit) && 'nuit',
|
|
61
121
|
(enTient(racine, estUnBanc) || fichiersTemoins(racine).length > 0) && 'mesures',
|
|
62
122
|
].filter(Boolean);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Plays the night tests, then the measures of time, of the copy at <racine>: 0, 75 or the code of
|
|
127
|
+
* the first red run of Vitest; 0 when there is none. With <horsDuPoste>, the night tests alone, but
|
|
128
|
+
* those tagged `@poste`, and no measure.
|
|
129
|
+
* @param {string} racine the root of the copy
|
|
130
|
+
* With <tranche>, the night tests of its part alone, its reports written under RAPPORTS.
|
|
131
|
+
* @param {{ horsDuPoste?: boolean, tranche?: { index: number, count: number } }} [options] the night of a shared machine, its tranche
|
|
132
|
+
*/
|
|
133
|
+
export function testsDeNuit(racine, options = {}) {
|
|
134
|
+
const runs = runsDeLaNuit(racine, options);
|
|
63
135
|
if (runs.length === 0) {
|
|
64
136
|
return 0;
|
|
65
137
|
}
|
|
@@ -72,11 +144,25 @@ export function testsDeNuit(racine) {
|
|
|
72
144
|
process.stdout.write(`${e.message}\n`);
|
|
73
145
|
return e.code;
|
|
74
146
|
}
|
|
147
|
+
const { tranche } = options;
|
|
148
|
+
const rapports = path.join(racine, RAPPORTS);
|
|
149
|
+
if (tranche) {
|
|
150
|
+
for (const f of fichiersDeLaTranche(rapports, tranche)) {
|
|
151
|
+
rmSync(f, { force: true });
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const enTranche = tranche
|
|
155
|
+
? { [NUIT_TRANCHE]: JSON.stringify({ tranche: `${tranche.index}/${tranche.count}`, rapports }) }
|
|
156
|
+
: {};
|
|
75
157
|
const codes = runs.map(choix => {
|
|
76
158
|
const r = spawnSync(
|
|
77
159
|
'npx',
|
|
78
160
|
['--no-install', 'vitest', 'run', '--root', racine, '--config', CONFIGURATION],
|
|
79
|
-
{
|
|
161
|
+
{
|
|
162
|
+
cwd: racine,
|
|
163
|
+
stdio: 'inherit',
|
|
164
|
+
env: { ...process.env, [NUIT_VARIABLE]: choix, ...enTranche },
|
|
165
|
+
}
|
|
80
166
|
);
|
|
81
167
|
return r.status ?? 1;
|
|
82
168
|
});
|
|
@@ -88,5 +174,11 @@ export function testsDeNuit(racine) {
|
|
|
88
174
|
}
|
|
89
175
|
|
|
90
176
|
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
91
|
-
|
|
177
|
+
const { horsDuPoste, tranche, erreur } = lireLesArguments(process.argv.slice(2));
|
|
178
|
+
if (erreur) {
|
|
179
|
+
process.stderr.write(`${erreur}\n`);
|
|
180
|
+
process.exitCode = 2;
|
|
181
|
+
} else {
|
|
182
|
+
process.exitCode = testsDeNuit(process.cwd(), { horsDuPoste, tranche });
|
|
183
|
+
}
|
|
92
184
|
}
|