@roomi-fields/grillhouse 0.28.3 → 0.30.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 +739 -0
- package/bin/grillhouse.mjs +128 -26
- package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
- package/cadre/templates/projet/CLAUDE.md +5 -1
- package/cadre/templates/projet/README.md +11 -11
- package/cadre/templates/projet/_gitignore +2 -5
- package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
- package/cadre/templates/projet/package.json +2 -2
- package/charte.md +37 -4
- package/dist/temporal/acte.d.ts +24 -0
- package/dist/temporal/acte.js +139 -0
- package/dist/temporal/acte.js.map +1 -0
- package/dist/temporal/attributs.d.ts +6 -0
- package/dist/temporal/attributs.js +15 -0
- package/dist/temporal/attributs.js.map +1 -0
- package/dist/temporal/circuit/activites.d.ts +13 -0
- package/dist/temporal/circuit/activites.js +33 -0
- package/dist/temporal/circuit/activites.js.map +1 -0
- package/dist/temporal/circuit/client.d.ts +72 -0
- package/dist/temporal/circuit/client.js +247 -0
- package/dist/temporal/circuit/client.js.map +1 -0
- package/dist/temporal/circuit/commande.d.ts +2 -0
- package/dist/temporal/circuit/commande.js +238 -0
- package/dist/temporal/circuit/commande.js.map +1 -0
- package/dist/temporal/circuit/contrat.d.ts +305 -0
- package/dist/temporal/circuit/contrat.js +24 -0
- package/dist/temporal/circuit/contrat.js.map +1 -0
- package/dist/temporal/circuit/deroule.d.ts +3 -0
- package/dist/temporal/circuit/deroule.js +540 -0
- package/dist/temporal/circuit/deroule.js.map +1 -0
- package/dist/temporal/client.d.ts +47 -0
- package/dist/temporal/client.js +69 -0
- package/dist/temporal/client.js.map +1 -0
- package/dist/temporal/commande.d.ts +2 -0
- package/dist/temporal/commande.js +95 -0
- package/dist/temporal/commande.js.map +1 -0
- package/dist/temporal/deroules.d.ts +5 -0
- package/dist/temporal/deroules.js +10 -0
- package/dist/temporal/deroules.js.map +1 -0
- package/dist/temporal/etat.d.ts +33 -0
- package/dist/temporal/etat.js +59 -0
- package/dist/temporal/etat.js.map +1 -0
- package/dist/temporal/file/activites.d.ts +10 -0
- package/dist/temporal/file/activites.js +25 -0
- package/dist/temporal/file/activites.js.map +1 -0
- package/dist/temporal/file/client.d.ts +4 -0
- package/dist/temporal/file/client.js +6 -0
- package/dist/temporal/file/client.js.map +1 -0
- package/dist/temporal/file/contrat.d.ts +158 -0
- package/dist/temporal/file/contrat.js +14 -0
- package/dist/temporal/file/contrat.js.map +1 -0
- package/dist/temporal/file/deroule.d.ts +15 -0
- package/dist/temporal/file/deroule.js +235 -0
- package/dist/temporal/file/deroule.js.map +1 -0
- package/dist/temporal/installation.d.ts +124 -0
- package/dist/temporal/installation.js +408 -0
- package/dist/temporal/installation.js.map +1 -0
- package/dist/temporal/places/activites.d.ts +8 -0
- package/dist/temporal/places/activites.js +13 -0
- package/dist/temporal/places/activites.js.map +1 -0
- package/dist/temporal/places/client.d.ts +28 -0
- package/dist/temporal/places/client.js +64 -0
- package/dist/temporal/places/client.js.map +1 -0
- package/dist/temporal/places/contrat.d.ts +106 -0
- package/dist/temporal/places/contrat.js +21 -0
- package/dist/temporal/places/contrat.js.map +1 -0
- package/dist/temporal/places/deroule.d.ts +3 -0
- package/dist/temporal/places/deroule.js +198 -0
- package/dist/temporal/places/deroule.js.map +1 -0
- package/dist/temporal/sonde/activites.d.ts +6 -0
- package/dist/temporal/sonde/activites.js +52 -0
- package/dist/temporal/sonde/activites.js.map +1 -0
- package/dist/temporal/sonde/contrat.d.ts +35 -0
- package/dist/temporal/sonde/contrat.js +10 -0
- package/dist/temporal/sonde/contrat.js.map +1 -0
- package/dist/temporal/sonde/deroule.d.ts +3 -0
- package/dist/temporal/sonde/deroule.js +39 -0
- package/dist/temporal/sonde/deroule.js.map +1 -0
- package/dist/temporal/tickets/activites.d.ts +7 -0
- package/dist/temporal/tickets/activites.js +81 -0
- package/dist/temporal/tickets/activites.js.map +1 -0
- package/dist/temporal/tickets/client.d.ts +10 -0
- package/dist/temporal/tickets/client.js +31 -0
- package/dist/temporal/tickets/client.js.map +1 -0
- package/dist/temporal/tickets/contrat.d.ts +56 -0
- package/dist/temporal/tickets/contrat.js +13 -0
- package/dist/temporal/tickets/contrat.js.map +1 -0
- package/dist/temporal/tickets/deroule.d.ts +3 -0
- package/dist/temporal/tickets/deroule.js +94 -0
- package/dist/temporal/tickets/deroule.js.map +1 -0
- package/dist/temporal/travailleur.d.ts +2 -0
- package/dist/temporal/travailleur.js +69 -0
- package/dist/temporal/travailleur.js.map +1 -0
- package/docs/ARCHITECTURE.md +813 -53
- package/docs/CADRE.md +17 -0
- package/docs/INTERFACE.md +161 -30
- package/hooks/crochet.mjs +19 -2
- package/hooks/hooks.json +11 -0
- package/package.json +16 -4
- package/scripts/activites.mjs +2182 -0
- package/scripts/aiguillage.d.mts +37 -0
- package/scripts/aiguillage.mjs +328 -0
- package/scripts/avancement.mjs +159 -64
- package/scripts/bilan.mjs +37 -19
- package/scripts/cadre.mjs +11 -2
- package/scripts/circuit.mjs +888 -3654
- package/scripts/circuits-cles.d.mts +4 -0
- package/scripts/circuits-cles.mjs +21 -0
- package/scripts/circuits-du-serveur.mjs +105 -0
- package/scripts/codes-de-sortie.mjs +9 -0
- package/scripts/commandes-composees.mjs +45 -41
- package/scripts/commandes-du-path.d.mts +7 -0
- package/scripts/commandes-du-path.mjs +25 -0
- package/scripts/composition-des-langages.mjs +30 -11
- package/scripts/conformite.mjs +19 -10
- package/scripts/copies-finies.mjs +188 -42
- package/scripts/depart-du-ticket.d.mts +53 -0
- package/scripts/depart-du-ticket.mjs +124 -0
- package/scripts/dependances-internes.mjs +115 -0
- package/scripts/dernier-vert.mjs +7 -15
- package/scripts/donnees-cles.mjs +228 -0
- package/scripts/droits.mjs +11 -1
- package/scripts/effets.mjs +352 -0
- package/scripts/enveloppe/enveloppe.mjs +119 -8
- package/scripts/enveloppe/lancer.sh +27 -32
- package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
- package/scripts/enveloppe/travail-de-la-copie.mjs +99 -12
- package/scripts/etapes.mjs +6 -3
- package/scripts/faits-du-circuit.mjs +493 -0
- package/scripts/file-des-tickets.d.mts +21 -0
- package/scripts/file-des-tickets.mjs +58 -0
- package/scripts/flux-des-paquets.mjs +187 -0
- package/scripts/fusion-du-changelog.mjs +0 -1
- package/scripts/gardes-du-cadre.mjs +12 -2
- package/scripts/grillhouse-maj.mjs +16 -7
- package/scripts/integration/file.mjs +477 -422
- package/scripts/integration/integrer.mjs +20 -22
- package/scripts/integration/rejeu.mjs +19 -4
- package/scripts/jointure.d.ts +168 -28
- package/scripts/langages/cargo/commandes.mjs +426 -119
- package/scripts/langages/cargo/composants.mjs +187 -3
- package/scripts/langages/cargo/exemples.mjs +75 -17
- package/scripts/langages/cargo/index.mjs +32 -13
- package/scripts/langages/cargo/migrations/0.28.4-tailles-des-tests.mjs +35 -0
- package/scripts/langages/cargo/sccache.mjs +62 -16
- package/scripts/langages/cargo/squelette.mjs +72 -3
- package/scripts/langages/cargo/tailles-des-tests.mjs +195 -0
- package/scripts/langages/cargo/tests-de-head.mjs +159 -0
- package/scripts/langages/python/commandes.mjs +232 -79
- package/scripts/langages/python/composants.mjs +65 -3
- package/scripts/langages/python/exemples.mjs +21 -12
- package/scripts/langages/python/index.mjs +25 -5
- package/scripts/langages/python/lot.mjs +1 -36
- package/scripts/langages/python/squelette.mjs +119 -17
- package/scripts/langages/typescript/construire.mjs +6 -163
- package/scripts/langages/typescript/exemples.mjs +19 -11
- package/scripts/langages/typescript/frontieres.mjs +1 -1
- package/scripts/langages/typescript/index.mjs +48 -63
- package/scripts/langages/typescript/interfaces-contre-code.mjs +4 -4
- package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
- package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +31 -0
- package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
- package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
- package/scripts/langages/typescript/regle-des-tests.mjs +13 -0
- package/scripts/langages/typescript/squelette.mjs +18 -2
- package/scripts/langages/typescript/tailles-des-tests.mjs +40 -9
- package/scripts/langages/typescript/tests-de-nuit.mjs +44 -21
- package/scripts/langages/typescript/tests.mjs +17 -8
- package/scripts/langages/typescript/titres-de-tests.mjs +297 -0
- package/scripts/langages/typescript/turbo-des-paquets.mjs +183 -38
- package/scripts/langages/typescript/verdict.mjs +1 -1
- package/scripts/langages/typescript/verifier.mjs +110 -296
- package/scripts/langages/typescript/vitest-config/base.mjs +30 -10
- package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
- package/scripts/langages/typescript/vitest-config/cibles.mjs +123 -62
- package/scripts/langages/typescript/vitest-config/delais.mjs +54 -0
- package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
- package/scripts/langages/typescript/vitest-config/duree.classement.mjs +100 -0
- package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +56 -64
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +7 -2
- package/scripts/langages/typescript/vitest-config/mesure.mjs +3 -2
- package/scripts/langages/typescript/vitest.nuit.config.mjs +22 -13
- package/scripts/lecture-unique.mjs +51 -0
- package/scripts/mesure/pression.mjs +11 -9
- package/scripts/mesure-de-la-machine.d.mts +21 -0
- package/scripts/mesure-de-la-machine.mjs +76 -0
- package/scripts/migrations/0.23.2-copies-du-cadre.mjs +8 -2
- package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +120 -0
- package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
- package/scripts/migrations.mjs +5 -0
- package/scripts/nuit.sh +29 -15
- package/scripts/outil.mjs +72 -0
- package/scripts/outils-cles.d.mts +24 -0
- package/scripts/outils-cles.mjs +0 -1
- package/scripts/paquet-npm.mjs +147 -0
- package/scripts/paquet.mjs +112 -14
- package/scripts/paquets.mjs +34 -6
- package/scripts/passe-de-la-machine.mjs +66 -0
- package/scripts/places-de-la-machine.mjs +360 -0
- package/scripts/places-du-serveur.mjs +170 -0
- package/scripts/prefixe-des-tickets.mjs +68 -0
- package/scripts/preparation.mjs +10 -3
- package/scripts/registre.mjs +3 -2
- package/scripts/regles-des-places.d.mts +36 -0
- package/scripts/regles-des-places.mjs +70 -0
- package/scripts/reponses-du-circuit.d.mts +6 -0
- package/scripts/reponses-du-circuit.mjs +28 -0
- package/scripts/resultats.mjs +29 -14
- package/scripts/retirer-les-copies-finies.mjs +25 -0
- package/scripts/sans-reponse.d.mts +4 -0
- package/scripts/sans-reponse.mjs +13 -0
- package/scripts/seances.mjs +918 -0
- package/scripts/services-du-noyau.mjs +28 -11
- package/scripts/session-start.sh +10 -1
- package/scripts/sortie.mjs +23 -4
- package/scripts/sources.mjs +3 -3
- package/scripts/sous-commandes.mjs +39 -9
- package/scripts/style-a-l-ecriture.mjs +229 -0
- package/scripts/superviseur.mjs +382 -16
- package/scripts/tableau.mjs +329 -130
- package/scripts/taches-du-graphe.mjs +328 -0
- package/scripts/ticket-du-circuit.mjs +206 -0
- package/scripts/transitions.d.mts +148 -0
- package/scripts/transitions.mjs +901 -0
- package/scripts/verrou-de-fichier.mjs +2 -2
- package/scripts/verrou-de-machine.mjs +322 -62
- package/skills/developpeur/SKILL.md +11 -3
- package/skills/explorateur/SKILL.md +2 -1
- package/skills/pitmaster/SKILL.md +62 -28
- package/skills/pitmaster/references/consigne-agent.md +5 -1
- package/skills/release/SKILL.md +3 -3
- package/skills/relecteur/SKILL.md +22 -8
- package/skills/testwriter/SKILL.md +47 -39
- package/scripts/demon.mjs +0 -138
- package/scripts/integration/file-attente.mjs +0 -61
- package/scripts/langages/cargo/touches.mjs +0 -93
- package/scripts/langages/typescript/script-des-tests.mjs +0 -6
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// The delays of the sizes of test, in ms, on the model of Bazel's test-encyclopedia: small, medium,
|
|
2
|
+
// large. A module of its own, with no import: the configurations of Vitest (./base.mjs,
|
|
3
|
+
// ../vitest.nuit.config.mjs) are bundled by Vite and read only these numbers, while the
|
|
4
|
+
// classification that deduces a file's size (./delais.mjs) reads the guard of the sizes, a script.
|
|
5
|
+
|
|
6
|
+
/** The delay of each size, in ms (Bazel: small 60 s, medium 300 s, large 900 s). */
|
|
7
|
+
export const DELAIS_MS = { petit: 60000, moyen: 300000, grand: 900000 };
|
|
8
|
+
|
|
9
|
+
/** The delay of a night test, in ms: the large delay. */
|
|
10
|
+
export const DELAI_NUIT_MS = DELAIS_MS.grand;
|
|
11
|
+
|
|
12
|
+
/** The delay of a size as a line writes it: « petit, 60 s ». */
|
|
13
|
+
export const libelleDuDelai = taille => `${taille}, ${DELAIS_MS[taille] / 1000} s`;
|
|
@@ -7,10 +7,9 @@
|
|
|
7
7
|
//
|
|
8
8
|
// - The value is JSON: `arguments`, Vitest's arguments (the paths, absolute, and the options
|
|
9
9
|
// written `--<name>=<value>`), which Vitest's own parser of its command line (`parseCLI`,
|
|
10
|
-
// vitest/node) reads; `rejouer`, the moment of a run that plays the tests for real (`--force
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
// process the tests start receives it.
|
|
10
|
+
// vitest/node) reads; `rejouer`, the moment of a run that plays the tests for real (`--force`,
|
|
11
|
+
// a complete pass of `npm run verifier`), which only moves the hash. The plugin takes the
|
|
12
|
+
// variable out of the environment once read: no process the tests start receives it.
|
|
14
13
|
// - A plugin of the base configuration (./base.mjs) reads it once the configuration is merged (its
|
|
15
14
|
// `config` hook; Vitest reads the test options in `configResolved`, after every `config` hook):
|
|
16
15
|
// the files played are the test files of the configuration's `include` (Vitest's default when
|
|
@@ -19,43 +18,59 @@
|
|
|
19
18
|
// A path of another package names none of its files. Each option enters the test configuration
|
|
20
19
|
// as Vitest merges its command line over it (`exclude` given on the command line is
|
|
21
20
|
// `cliExclude`, as Vitest's `normalizeCliOptions` names it).
|
|
22
|
-
// -
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
// (
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
//
|
|
39
|
-
//
|
|
21
|
+
// - Every measure of time plays at night (grillhouse-bd7), as Bazel leaves a target tagged
|
|
22
|
+
// `manual` out of every pattern and the benchmarks of Chromium and rustc-perf leave the CI of
|
|
23
|
+
// each commit for a machine at rest: a time budget bench (BUDGET) and a time witness, a test
|
|
24
|
+
// file that imports the mark of a measure of time (`import { mesurerAuRepos } from
|
|
25
|
+
// '@roomi-fields/grillhouse/vitest-config/mesure'`, a line of its own, `estTemoin`), are out of
|
|
26
|
+
// the day, as a night test (NUIT) is. The base configuration excludes the patterns HORS_DU_JOUR;
|
|
27
|
+
// the plugin excludes the witnesses found under the configuration's directory
|
|
28
|
+
// (`fichiersTemoins`, node_modules, dist, .git, .turbo and .claude left out), with or without
|
|
29
|
+
// the variable.
|
|
30
|
+
// - A night test named is refused, named, and nothing plays: the night alone plays it
|
|
31
|
+
// (./tests-de-nuit.mjs).
|
|
32
|
+
// - A bench or a witness plays when its own file is named, as Bazel's target tagged
|
|
33
|
+
// `manual` builds when named: the day's exclusions lift for that file, the include of the
|
|
34
|
+
// configuration notwithstanding, and the measure of time of the base configuration applies, its
|
|
35
|
+
// duration reporter giving 75, « à repasser », to a measure that fails under load. A directory
|
|
36
|
+
// named leaves them out, as the day does.
|
|
37
|
+
// - A run whose paths name no test file plays none, and fails: the base configuration keeps
|
|
38
|
+
// Vitest's `passWithNoTests: false`.
|
|
39
|
+
// - The night's configuration (scripts/langages/typescript/vitest.nuit.config.mjs) plays what the
|
|
40
|
+
// day leaves out, through the plugin `nuit`: the night tests, the benches and the witnesses; the
|
|
41
|
+
// variable `GRILLHOUSE_TESTS_DE_NUIT` (NUIT_VARIABLE) chooses `nuit`, the night tests alone, or
|
|
42
|
+
// `mesures`, the benches and the witnesses alone, one file at a time (`fileParallelism: false`),
|
|
43
|
+
// as scripts/langages/typescript/tests-de-nuit.mjs plays them.
|
|
40
44
|
// - The changes since the last green (`GRILLHOUSE_CHANGEMENTS`, ./changements.mjs) restrict the
|
|
41
45
|
// files played to those Vitest relates to them, the files named themselves kept, or leave every
|
|
42
46
|
// test when a change lies out of Vitest's graph.
|
|
43
47
|
//
|
|
44
|
-
// This module's top level uses Node alone: scripts/langages/typescript/tests.mjs reads its VARIABLE.
|
|
45
48
|
import { globSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
46
49
|
import path from 'node:path';
|
|
47
|
-
import { CHANGEMENTS } from '../../../services-du-noyau.mjs';
|
|
50
|
+
import { CHANGEMENTS, TESTS_CIBLES } from '../../../services-du-noyau.mjs';
|
|
48
51
|
import { lireChangements, restreindre } from './changements.mjs';
|
|
49
52
|
|
|
50
|
-
|
|
53
|
+
// The name of the variable is the core's (`TESTS_CIBLES`); this module reads it under its own name.
|
|
54
|
+
export const VARIABLE = TESTS_CIBLES;
|
|
51
55
|
// The day's exclusions, which the base configuration (./base.mjs) sets and the night plays
|
|
52
56
|
// (scripts/langages/typescript/vitest.nuit.config.mjs): the night tests, too long for the day, and the time budget
|
|
53
57
|
// benches, whose measures move with the load of the day.
|
|
54
58
|
export const NUIT = '**/*.nuit.{test,spec}.?(c|m)[jt]s?(x)';
|
|
55
59
|
export const BUDGET = '**/*.budget.{test,spec}.?(c|m)[jt]s?(x)';
|
|
56
60
|
export const HORS_DU_JOUR = [NUIT, BUDGET];
|
|
57
|
-
|
|
58
|
-
const
|
|
61
|
+
/** The variable that chooses the tests of a run of the night's configuration: `nuit` or `mesures`. */
|
|
62
|
+
export const NUIT_VARIABLE = 'GRILLHOUSE_TESTS_DE_NUIT';
|
|
63
|
+
// Whether the file at <fichier> bears the name of <motif>, a globstar then a name: by the name of
|
|
64
|
+
// the file, since a globstar passes no directory whose name starts with a dot, and a ticket's copy
|
|
65
|
+
// lives under `.claude/worktrees/`.
|
|
66
|
+
const parSonNom = (fichier, motif) =>
|
|
67
|
+
path.matchesGlob(path.basename(fichier), motif.replace(/^\*\*\//, ''));
|
|
68
|
+
/** Whether the file at <fichier> is a night test, by its name: the one rule of the frame. */
|
|
69
|
+
export const estUnTestDeNuit = fichier => parSonNom(fichier, NUIT);
|
|
70
|
+
/** Whether the file at <fichier> is a time budget bench, by its name. */
|
|
71
|
+
export const estUnBanc = fichier => parSonNom(fichier, BUDGET);
|
|
72
|
+
/** Whether the file at <fichier> is a night test or a time budget bench, by its name. */
|
|
73
|
+
export const deNuitOuBanc = fichier => HORS_DU_JOUR.some(p => parSonNom(fichier, p));
|
|
59
74
|
// Vitest's default `include` (its configDefaults).
|
|
60
75
|
const INCLUDE = ['**/*.{test,spec}.?(c|m)[jt]s?(x)'];
|
|
61
76
|
// The mark of a time witness: the import of `mesurerAuRepos`, on a line of its own, from the
|
|
@@ -64,19 +79,27 @@ const MARQUE_TEMOIN =
|
|
|
64
79
|
/^import\s*\{[^}]*\bmesurerAuRepos\b[^}]*\}\s*from\s*['"][^'"]*vitest-config\/mesure(?:\.mjs)?['"]/m;
|
|
65
80
|
// Whether the text <texte> of a test file is that of a time witness.
|
|
66
81
|
const estTemoin = texte => MARQUE_TEMOIN.test(texte);
|
|
82
|
+
const lireTexte = f => {
|
|
83
|
+
try {
|
|
84
|
+
return readFileSync(f, 'utf8');
|
|
85
|
+
} catch {
|
|
86
|
+
return '';
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Whether the test file at <fichier> is out of the day: a night test, a time budget bench or a
|
|
92
|
+
* time witness; the night and the bench by its name (`deNuitOuBanc`).
|
|
93
|
+
* @param {string} fichier the path of the file
|
|
94
|
+
*/
|
|
95
|
+
export const estHorsDuJour = fichier => deNuitOuBanc(fichier) || estTemoin(lireTexte(fichier));
|
|
67
96
|
// The directories a search of the witnesses leaves out.
|
|
68
97
|
const HORS_TEMOINS = new Set(['node_modules', 'dist', '.git', '.turbo', '.claude']);
|
|
69
98
|
|
|
70
99
|
// The time witnesses under <dir>: the test files of <include> (Vitest's default without it), the
|
|
71
100
|
// day's exclusions left out, that `estTemoin`; each path relative to <dir>, sorted.
|
|
72
101
|
export function fichiersTemoins(dir, include = INCLUDE) {
|
|
73
|
-
const lire = f =>
|
|
74
|
-
try {
|
|
75
|
-
return readFileSync(path.join(dir, f), 'utf8');
|
|
76
|
-
} catch {
|
|
77
|
-
return '';
|
|
78
|
-
}
|
|
79
|
-
};
|
|
102
|
+
const lire = f => lireTexte(path.join(dir, f));
|
|
80
103
|
return [
|
|
81
104
|
...new Set(
|
|
82
105
|
globSync(include, { cwd: dir, exclude: d => HORS_TEMOINS.has(path.basename(d)) }).map(f =>
|
|
@@ -84,7 +107,7 @@ export function fichiersTemoins(dir, include = INCLUDE) {
|
|
|
84
107
|
)
|
|
85
108
|
),
|
|
86
109
|
]
|
|
87
|
-
.filter(f => !
|
|
110
|
+
.filter(f => !deNuitOuBanc(f) && estTemoin(lire(f)))
|
|
88
111
|
.sort();
|
|
89
112
|
}
|
|
90
113
|
// The directories a walk under a named directory leaves out, whose files no test configuration
|
|
@@ -120,7 +143,16 @@ const fusion = (cible, valeur) =>
|
|
|
120
143
|
)
|
|
121
144
|
: valeur;
|
|
122
145
|
|
|
123
|
-
// The
|
|
146
|
+
// The time witnesses under the directory of the test options <test> of <config>, each a pattern
|
|
147
|
+
// relative to it that names its file alone.
|
|
148
|
+
const temoinsDe = (config, test) =>
|
|
149
|
+
fichiersTemoins(
|
|
150
|
+
path.resolve(config.root ?? process.cwd(), test.dir ?? ''),
|
|
151
|
+
test.include ?? INCLUDE
|
|
152
|
+
).map(r => r.replace(SPECIAUX, '\\$&'));
|
|
153
|
+
|
|
154
|
+
// The plugin of the day: the time witnesses out of the run, and the run restricted to the tests
|
|
155
|
+
// <env> names in VARIABLE.
|
|
124
156
|
export const ciblage = (env = process.env, dire = l => process.stdout.write(`${l}\n`)) => ({
|
|
125
157
|
name: 'grillhouse:cibles',
|
|
126
158
|
async config(config) {
|
|
@@ -128,14 +160,18 @@ export const ciblage = (env = process.env, dire = l => process.stdout.write(`${l
|
|
|
128
160
|
const changements = env[CHANGEMENTS];
|
|
129
161
|
delete env[VARIABLE];
|
|
130
162
|
delete env[CHANGEMENTS];
|
|
131
|
-
if (!texte && !changements) {
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
163
|
const test = (config.test ??= {});
|
|
164
|
+
const temoins = temoinsDe(config, test);
|
|
135
165
|
// The files a targeted run names themselves, absolute.
|
|
136
166
|
let nommes = [];
|
|
137
167
|
if (texte) {
|
|
138
|
-
nommes = await cibler(config, test, JSON.parse(texte));
|
|
168
|
+
nommes = await cibler(config, test, JSON.parse(texte), new Set(temoins));
|
|
169
|
+
}
|
|
170
|
+
// The witnesses out of the day, but those named themselves (in the include then).
|
|
171
|
+
const joues = new Set(Array.isArray(test.include) ? test.include : []);
|
|
172
|
+
const hors = nommes.length ? temoins.filter(t => !joues.has(t)) : temoins;
|
|
173
|
+
if (hors.length) {
|
|
174
|
+
test.exclude = [...(test.exclude ?? ['**/node_modules/**']), ...hors];
|
|
139
175
|
}
|
|
140
176
|
const ch = changements ? lireChangements(changements) : null;
|
|
141
177
|
// A targeted run whose paths name no test file plays none, and fails, as without the changes.
|
|
@@ -145,47 +181,48 @@ export const ciblage = (env = process.env, dire = l => process.stdout.write(`${l
|
|
|
145
181
|
},
|
|
146
182
|
});
|
|
147
183
|
|
|
148
|
-
// Applies the value <valeur> of VARIABLE to the configuration <config>, its test options <test
|
|
149
|
-
// the files named themselves,
|
|
150
|
-
|
|
184
|
+
// Applies the value <valeur> of VARIABLE to the configuration <config>, its test options <test>,
|
|
185
|
+
// <temoins> the time witnesses (patterns relative to its directory): the files named themselves,
|
|
186
|
+
// absolute.
|
|
187
|
+
async function cibler(config, test, valeur, temoins) {
|
|
151
188
|
const { parseCLI } = await import('vitest/node');
|
|
152
189
|
const { filter, options } = parseCLI(['vitest', ...(valeur.arguments ?? [])]);
|
|
153
190
|
let nommes = [];
|
|
154
|
-
// The time witnesses: left out of the pass, or played alone in their own.
|
|
155
|
-
if (valeur.temoins === 'hors' || valeur.temoins === 'seuls') {
|
|
156
|
-
const dir = path.resolve(config.root ?? process.cwd(), test.dir ?? '');
|
|
157
|
-
const temoins = fichiersTemoins(dir, test.include ?? INCLUDE).map(r =>
|
|
158
|
-
r.replace(SPECIAUX, '\\$&')
|
|
159
|
-
);
|
|
160
|
-
if (valeur.temoins === 'hors') {
|
|
161
|
-
test.exclude = [...(test.exclude ?? ['**/node_modules/**']), ...temoins];
|
|
162
|
-
} else {
|
|
163
|
-
test.include = temoins.length ? temoins : [`${VARIABLE}-sans-temoin`];
|
|
164
|
-
test.passWithNoTests = true;
|
|
165
|
-
test.fileParallelism = false;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
191
|
if (filter.length) {
|
|
169
192
|
const dir = path.resolve(config.root ?? process.cwd(), test.dir ?? '');
|
|
170
193
|
const include = test.include ?? INCLUDE;
|
|
171
194
|
const chemins = filter.map(f => path.resolve(f.replace(/[\\/]+$/, '')));
|
|
195
|
+
const relatif = f => path.relative(dir, f).split(path.sep).join('/');
|
|
172
196
|
// The files named themselves, not through a directory.
|
|
173
197
|
const seuls = new Set(chemins.filter(f => fichiers(f)[0] === f));
|
|
198
|
+
// A night test plays at night alone (./tests-de-nuit.mjs): a targeted run refuses it, named.
|
|
199
|
+
const deNuit = [...seuls].filter(estUnTestDeNuit);
|
|
200
|
+
if (deNuit.length) {
|
|
201
|
+
throw new Error(
|
|
202
|
+
deNuit
|
|
203
|
+
.map(
|
|
204
|
+
f =>
|
|
205
|
+
`⛔ ${relatif(f)} : un test de nuit se joue la nuit seulement (npx grillhouse nuit le joue)`
|
|
206
|
+
)
|
|
207
|
+
.join('\n')
|
|
208
|
+
);
|
|
209
|
+
}
|
|
174
210
|
nommes = [...seuls];
|
|
175
|
-
const relatif = f => path.relative(dir, f).split(path.sep).join('/');
|
|
176
211
|
const joues = [...new Set(chemins.flatMap(fichiers))]
|
|
177
212
|
.filter(f => {
|
|
178
213
|
const r = relatif(f);
|
|
179
214
|
if (r.startsWith('../')) {
|
|
180
215
|
return false;
|
|
181
216
|
}
|
|
182
|
-
return
|
|
217
|
+
return deNuitOuBanc(r) || temoins.has(r.replace(SPECIAUX, '\\$&'))
|
|
218
|
+
? seuls.has(f)
|
|
219
|
+
: include.some(p => path.matchesGlob(r, p));
|
|
183
220
|
})
|
|
184
221
|
.map(relatif)
|
|
185
222
|
.sort();
|
|
186
|
-
// A bench
|
|
187
|
-
// files under a directory named stay out by the filter above.
|
|
188
|
-
if (joues.some(
|
|
223
|
+
// A bench named itself plays: the day's exclusions lift, and the
|
|
224
|
+
// files under a directory named stay out by the filter above (a witness, by the plugin).
|
|
225
|
+
if (joues.some(deNuitOuBanc) && Array.isArray(test.exclude)) {
|
|
189
226
|
test.exclude = test.exclude.filter(p => !HORS_DU_JOUR.includes(p));
|
|
190
227
|
}
|
|
191
228
|
// No file named: a pattern that matches none, Vitest's « No test files found ».
|
|
@@ -206,3 +243,27 @@ async function cibler(config, test, valeur) {
|
|
|
206
243
|
}
|
|
207
244
|
return nommes;
|
|
208
245
|
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* The plugin of the night's configuration: the night tests, the benches and the time witnesses
|
|
249
|
+
* under its directory, or, as <env> chooses in NUIT_VARIABLE, the night tests alone (`nuit`) or
|
|
250
|
+
* the measures alone, one file at a time (`mesures`), the benches and the witnesses.
|
|
251
|
+
* @param {NodeJS.ProcessEnv} [env] the environment that holds the choice
|
|
252
|
+
*/
|
|
253
|
+
export const nuit = (env = process.env) => ({
|
|
254
|
+
name: 'grillhouse:nuit',
|
|
255
|
+
config(config) {
|
|
256
|
+
const choix = env[NUIT_VARIABLE];
|
|
257
|
+
delete env[NUIT_VARIABLE];
|
|
258
|
+
const test = (config.test ??= {});
|
|
259
|
+
const temoins = temoinsDe(config, { ...test, include: INCLUDE });
|
|
260
|
+
if (choix === 'nuit') {
|
|
261
|
+
test.include = [NUIT];
|
|
262
|
+
} else if (choix === 'mesures') {
|
|
263
|
+
test.include = [BUDGET, ...temoins];
|
|
264
|
+
test.fileParallelism = false;
|
|
265
|
+
} else {
|
|
266
|
+
test.include = [...HORS_DU_JOUR, ...temoins];
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// The delay of each size of test, on the model of Bazel's test-encyclopedia (a delay per size; a
|
|
2
|
+
// test past it is killed) and of Vitest's `slowTestThreshold`.
|
|
3
|
+
//
|
|
4
|
+
// - The delay of a day test file is deduced from its size by the classification of the guard of
|
|
5
|
+
// the sizes (`classer`, ../tailles-des-tests.mjs), the one address of the rule; the three delays
|
|
6
|
+
// are written once, in ./bornes.mjs.
|
|
7
|
+
// - A file out of the day (a night test, a bench, a time witness) that a targeted run plays has the
|
|
8
|
+
// large delay, whatever its text reads.
|
|
9
|
+
// - A setup file of the base configuration applies the delay of its file to each test file
|
|
10
|
+
// (./delais.setup.mjs).
|
|
11
|
+
import { existsSync } from 'node:fs';
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
import { lesMatieres, classer } from '../tailles-des-tests.mjs';
|
|
14
|
+
import { DELAI_NUIT_MS, DELAIS_MS, libelleDuDelai } from './bornes.mjs';
|
|
15
|
+
import { estHorsDuJour } from './cibles.mjs';
|
|
16
|
+
import { lireLeDisque } from './lances.mjs';
|
|
17
|
+
|
|
18
|
+
export { DELAI_NUIT_MS, DELAIS_MS, libelleDuDelai };
|
|
19
|
+
|
|
20
|
+
const memoMatieres = new Map();
|
|
21
|
+
const matieresDe = racine => {
|
|
22
|
+
if (!memoMatieres.has(racine)) memoMatieres.set(racine, lesMatieres(racine));
|
|
23
|
+
return memoMatieres.get(racine);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The delay of the test file <fichier> (absolute), read by <lire> in the repository at <racine>:
|
|
28
|
+
* `{ taille, delai }`, `delai` in ms.
|
|
29
|
+
*/
|
|
30
|
+
export function delaisDuFichier(fichier, { lire, racine }) {
|
|
31
|
+
const taille = estHorsDuJour(fichier)
|
|
32
|
+
? 'grand'
|
|
33
|
+
: classer(fichier, lire, racine, matieresDe(racine)).taille;
|
|
34
|
+
return { taille, delai: DELAIS_MS[taille] };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** The settings Vitest applies to the test file <fichier>: its delay for a test and a hook. */
|
|
38
|
+
export function reglagesDuFichier(fichier, options) {
|
|
39
|
+
const { delai } = delaisDuFichier(fichier, options);
|
|
40
|
+
return { testTimeout: delai, hookTimeout: delai };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** The root of the repository that holds <fichier>: the first directory above with a `.git`. */
|
|
44
|
+
export function racineDuDepot(fichier) {
|
|
45
|
+
for (let d = path.dirname(fichier); ; d = path.dirname(d)) {
|
|
46
|
+
if (existsSync(path.join(d, '.git'))) return d;
|
|
47
|
+
if (path.dirname(d) === d) return process.cwd();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** The delay of <fichier> as the disk of its repository gives it. */
|
|
52
|
+
export function delaisSurLeDisque(fichier) {
|
|
53
|
+
return delaisDuFichier(fichier, { lire: lireLeDisque, racine: racineDuDepot(fichier) });
|
|
54
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// A setup file of the base configuration: a test file has the delay of its size, as Bazel gives
|
|
2
|
+
// each test the delay of its `size`. It reads the size of the file it sets up (./delais.mjs, by the
|
|
3
|
+
// classification of the guard of the sizes) and gives Vitest its delay for a test and a hook.
|
|
4
|
+
import { vi } from 'vitest';
|
|
5
|
+
import { delaisSurLeDisque } from './delais.mjs';
|
|
6
|
+
|
|
7
|
+
const fichier = globalThis.__vitest_worker__?.filepath;
|
|
8
|
+
if (fichier) {
|
|
9
|
+
const { delai } = delaisSurLeDisque(fichier);
|
|
10
|
+
vi.setConfig({ testTimeout: delai, hookTimeout: delai });
|
|
11
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// The classification of the duration reporter (./duree.reporter.mjs), a pure function: it takes
|
|
2
|
+
// data (the tasks of the run, the errors outside the tests, the CPU pressures at the start and at
|
|
3
|
+
// the end, Vitest's exit code, and per file its size label, whether it is out of the day and
|
|
4
|
+
// whether it is a time budget bench, by the rules of ./cibles.mjs) and
|
|
5
|
+
// never reads the disk nor the global state. The reporter reads those, calls `classer`, writes the
|
|
6
|
+
// lines and sets the exit code.
|
|
7
|
+
//
|
|
8
|
+
// A failure depends on a duration when it is a failure of a time budget bench (a file
|
|
9
|
+
// `*.budget.test.*`, `*.budget.spec.*`), of a test marked as a measure of time (`mesurerAuRepos`),
|
|
10
|
+
// or a delay past (« Test timed out in <n>ms. », « Hook timed out in <n>ms. ») in a file out of the
|
|
11
|
+
// day; every other failure is a real red, a delay past in a day test included.
|
|
12
|
+
//
|
|
13
|
+
// The verdict is `a-repasser` when every failure depends on a duration and at least one took place
|
|
14
|
+
// under load (pressure at or above the threshold at the start or at the end); `rouge` when they
|
|
15
|
+
// all took place at rest; `vitest` (Vitest's verdict stands) when a failure is real, an error is
|
|
16
|
+
// outside the tests, Vitest's code is not 1, or no pressure reads; no pressure measured at all
|
|
17
|
+
// (no failure of duration) gives no line of conclusion.
|
|
18
|
+
import { A_REPASSER, SEUIL_PRESSION } from '../../../services-du-noyau.mjs';
|
|
19
|
+
|
|
20
|
+
const DELAI = /^(Test|Hook) timed out in \d+ms\./;
|
|
21
|
+
|
|
22
|
+
function* taches(t) {
|
|
23
|
+
yield t;
|
|
24
|
+
for (const c of t.tasks ?? []) yield* taches(c);
|
|
25
|
+
}
|
|
26
|
+
const fichierDe = t => {
|
|
27
|
+
let x = t;
|
|
28
|
+
while (x && !x.filepath) x = x.suite ?? x.file;
|
|
29
|
+
return x?.filepath ?? '';
|
|
30
|
+
};
|
|
31
|
+
const nomDe = t => {
|
|
32
|
+
const noms = [];
|
|
33
|
+
for (let x = t; x && !x.filepath; x = x.suite) noms.unshift(x.name);
|
|
34
|
+
return noms.join(' › ');
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @param {{ files?: any[], errors?: unknown[], debut: number | null, fin: number | null,
|
|
39
|
+
* codeDeSortie: number | undefined, fichiers: Record<string, { horsDuJour: boolean, banc?: boolean, libelleDelai: string }> }} entree
|
|
40
|
+
*/
|
|
41
|
+
export function classer({ files = [], errors = [], debut, fin, codeDeSortie, fichiers }) {
|
|
42
|
+
const echecs = [];
|
|
43
|
+
for (const f of files) {
|
|
44
|
+
for (const t of taches(f)) {
|
|
45
|
+
const erreurs = t.result?.errors ?? [];
|
|
46
|
+
if (t.type === 'test' ? t.result?.state !== 'fail' : erreurs.length === 0) continue;
|
|
47
|
+
const fichier = fichierDe(t);
|
|
48
|
+
const info = fichiers[fichier];
|
|
49
|
+
const delaiDepasse = erreurs.length > 0 && erreurs.every(e => DELAI.test(e.message ?? ''));
|
|
50
|
+
const cause =
|
|
51
|
+
t.type === 'test' && t.meta?.mesureDeTemps
|
|
52
|
+
? 'mesure de temps'
|
|
53
|
+
: info?.banc
|
|
54
|
+
? 'banc de temps'
|
|
55
|
+
: delaiDepasse && info?.horsDuJour
|
|
56
|
+
? 'délai dépassé'
|
|
57
|
+
: 'réel';
|
|
58
|
+
echecs.push({
|
|
59
|
+
fichier,
|
|
60
|
+
nom: nomDe(t),
|
|
61
|
+
cause,
|
|
62
|
+
delai: delaiDepasse ? (info?.libelleDelai ?? null) : null,
|
|
63
|
+
pressionDebut: t.type === 'test' ? (t.meta?.pressionDebut ?? debut) : debut,
|
|
64
|
+
pressionFin: t.type === 'test' ? (t.meta?.pressionFin ?? fin) : fin,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const dependants = echecs.filter(e => e.cause !== 'réel');
|
|
69
|
+
if (dependants.length === 0) {
|
|
70
|
+
// No failure of duration: no pressure measured, so no line of conclusion.
|
|
71
|
+
return { echecs, verdict: 'vitest', conclusion: null };
|
|
72
|
+
}
|
|
73
|
+
if (dependants.length < echecs.length || errors.length > 0 || codeDeSortie !== 1) {
|
|
74
|
+
return {
|
|
75
|
+
echecs,
|
|
76
|
+
verdict: 'vitest',
|
|
77
|
+
conclusion: 'un échec ne dépend pas d’une durée : verdict de Vitest.',
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const lues = dependants.flatMap(e => [e.pressionDebut, e.pressionFin]).filter(p => p !== null);
|
|
81
|
+
if (lues.length === 0) {
|
|
82
|
+
return {
|
|
83
|
+
echecs,
|
|
84
|
+
verdict: 'vitest',
|
|
85
|
+
conclusion: 'pression CPU illisible (/proc/pressure/cpu) : verdict de Vitest.',
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
if (lues.some(p => p >= SEUIL_PRESSION)) {
|
|
89
|
+
return {
|
|
90
|
+
echecs,
|
|
91
|
+
verdict: 'a-repasser',
|
|
92
|
+
conclusion: `à repasser (code ${A_REPASSER}) : chaque échec dépend d’une durée, et au moins un a eu lieu sous charge ; ni vert ni rouge, la mesure se rejoue au repos.`,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
echecs,
|
|
97
|
+
verdict: 'rouge',
|
|
98
|
+
conclusion: `échecs de durée au repos (pression CPU sous ${SEUIL_PRESSION} %) : rouge.`,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
@@ -3,10 +3,13 @@
|
|
|
3
3
|
// (`--reporter=<entry>`, or `reporters` in a configuration; types ./duree.reporter.d.ts). At the end
|
|
4
4
|
// of a run with failures, it reads each one:
|
|
5
5
|
//
|
|
6
|
-
// - a failure depends on a duration when it is a
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
6
|
+
// - a failure depends on a duration when it is a failure of a time budget bench (a file
|
|
7
|
+
// `*.budget.test.*`, `*.budget.spec.*`), of a test marked as a measure of time (`mesurerAuRepos`,
|
|
8
|
+
// ./mesure.mjs), or a delay past (an error « Test timed out in <n>ms. » or « Hook timed out in
|
|
9
|
+
// <n>ms. », Vitest's own message) in a file out of the day (a night test, a bench, a time
|
|
10
|
+
// witness: `estHorsDuJour` of ./cibles.mjs); every other failure is a real red, a delay past in
|
|
11
|
+
// a day test included: a delay of the day is a safeguard, not a measure, as in Bazel and Vitest
|
|
12
|
+
// (grillhouse-bd7), and one too tight widens, far above the test's usual duration;
|
|
10
13
|
// - it took place under load when the CPU pressure (./pression.mjs) was at or above the threshold
|
|
11
14
|
// at the start or at the end of the test (noted by ./mesure.setup.mjs), or, for a hook or a file
|
|
12
15
|
// that fails outside of a test, at the start or at the end of the run.
|
|
@@ -23,24 +26,33 @@ import {
|
|
|
23
26
|
lirePression,
|
|
24
27
|
SEUIL_PRESSION,
|
|
25
28
|
} from '../../../services-du-noyau.mjs';
|
|
29
|
+
import { estHorsDuJour, estUnBanc } from './cibles.mjs';
|
|
30
|
+
import { classer } from './duree.classement.mjs';
|
|
31
|
+
import { delaisSurLeDisque, libelleDuDelai } from './delais.mjs';
|
|
26
32
|
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
function aUnEchec(t) {
|
|
34
|
+
if (t.type === 'test' ? t.result?.state === 'fail' : (t.result?.errors ?? []).length > 0)
|
|
35
|
+
return true;
|
|
36
|
+
return (t.tasks ?? []).some(aUnEchec);
|
|
37
|
+
}
|
|
29
38
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
39
|
+
// The 20 slowest files of the run, slowest first, each with its share of the total time.
|
|
40
|
+
const PLUS_LENTS = 20;
|
|
41
|
+
function plusLents(files, dire) {
|
|
42
|
+
const duree = f => f.result?.duration ?? 0;
|
|
43
|
+
const total = files.reduce((s, f) => s + duree(f), 0);
|
|
44
|
+
if (total <= 0) return;
|
|
45
|
+
const lents = [...files].sort((a, b) => duree(b) - duree(a)).slice(0, PLUS_LENTS);
|
|
46
|
+
dire(
|
|
47
|
+
`${lents.length === 1 ? '1 fichier le plus lent' : `${lents.length} fichiers les plus lents`} (part du temps total, ${Math.round(total)} ms) :`
|
|
48
|
+
);
|
|
49
|
+
for (const f of lents) {
|
|
50
|
+
const part = ((100 * duree(f)) / total).toFixed(1);
|
|
51
|
+
dire(
|
|
52
|
+
`${part.padStart(5)} % ${Math.round(duree(f))} ms ${path.relative(process.cwd(), f.filepath)}`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
33
55
|
}
|
|
34
|
-
const fichierDe = t => {
|
|
35
|
-
let x = t;
|
|
36
|
-
while (x && !x.filepath) x = x.suite ?? x.file;
|
|
37
|
-
return x?.filepath ?? '';
|
|
38
|
-
};
|
|
39
|
-
const nomDe = t => {
|
|
40
|
-
const noms = [];
|
|
41
|
-
for (let x = t; x && !x.filepath; x = x.suite) noms.unshift(x.name);
|
|
42
|
-
return noms.join(' › ');
|
|
43
|
-
};
|
|
44
56
|
|
|
45
57
|
export default class DureeReporter {
|
|
46
58
|
onInit() {
|
|
@@ -49,57 +61,37 @@ export default class DureeReporter {
|
|
|
49
61
|
|
|
50
62
|
onFinished(files = [], errors = []) {
|
|
51
63
|
const fin = lirePression();
|
|
52
|
-
const
|
|
64
|
+
const dire = l => process.stdout.write(`⏱ ${l}\n`);
|
|
65
|
+
plusLents(files, dire);
|
|
66
|
+
const fichiers = {};
|
|
53
67
|
for (const f of files) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
68
|
+
if (!aUnEchec(f) || f.filepath in fichiers) continue;
|
|
69
|
+
fichiers[f.filepath] = {
|
|
70
|
+
horsDuJour: estHorsDuJour(f.filepath),
|
|
71
|
+
banc: estUnBanc(f.filepath),
|
|
72
|
+
libelleDelai: libelleDuDelai(delaisSurLeDisque(f.filepath).taille),
|
|
73
|
+
};
|
|
58
74
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
? 'délai dépassé'
|
|
73
|
-
: null;
|
|
74
|
-
if (!cause) {
|
|
75
|
-
reels++;
|
|
75
|
+
const { echecs, verdict, conclusion } = classer({
|
|
76
|
+
files,
|
|
77
|
+
errors,
|
|
78
|
+
debut: this.debut,
|
|
79
|
+
fin,
|
|
80
|
+
codeDeSortie: process.exitCode,
|
|
81
|
+
fichiers,
|
|
82
|
+
});
|
|
83
|
+
for (const e of echecs) {
|
|
84
|
+
const nom = path.relative(process.cwd(), e.fichier) + (e.nom ? ` › ${e.nom}` : '');
|
|
85
|
+
const delai = e.delai ? ` (${e.delai})` : '';
|
|
86
|
+
if (e.cause === 'réel') {
|
|
87
|
+
if (e.delai) dire(`${nom} : délai dépassé${delai}.`);
|
|
76
88
|
continue;
|
|
77
89
|
}
|
|
78
|
-
const debut = t.type === 'test' ? (t.meta?.pressionDebut ?? this.debut) : this.debut;
|
|
79
|
-
const finT = t.type === 'test' ? (t.meta?.pressionFin ?? fin) : fin;
|
|
80
|
-
pressions.push(debut, finT);
|
|
81
|
-
const nom = nomDe(t);
|
|
82
|
-
dire(
|
|
83
|
-
`${path.relative(process.cwd(), fichier)}${nom ? ` › ${nom}` : ''} : ${cause}, pression CPU ${ecrirePression(debut)} au début, ${ecrirePression(finT)} à la fin (seuil ${SEUIL_PRESSION} %).`
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
if (pressions.length === 0) return;
|
|
87
|
-
if (reels > 0 || errors.length > 0 || process.exitCode !== 1) {
|
|
88
|
-
dire('un échec ne dépend pas d’une durée : verdict de Vitest.');
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
const lues = pressions.filter(p => p !== null);
|
|
92
|
-
if (lues.length === 0) {
|
|
93
|
-
dire('pression CPU illisible (/proc/pressure/cpu) : verdict de Vitest.');
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
if (lues.some(p => p >= SEUIL_PRESSION)) {
|
|
97
90
|
dire(
|
|
98
|
-
|
|
91
|
+
`${nom} : ${e.cause}${delai}, pression CPU ${ecrirePression(e.pressionDebut)} au début, ${ecrirePression(e.pressionFin)} à la fin (seuil ${SEUIL_PRESSION} %).`
|
|
99
92
|
);
|
|
100
|
-
process.exitCode = A_REPASSER;
|
|
101
|
-
return;
|
|
102
93
|
}
|
|
103
|
-
|
|
94
|
+
if (conclusion) dire(conclusion);
|
|
95
|
+
if (verdict === 'a-repasser') process.exitCode = A_REPASSER;
|
|
104
96
|
}
|
|
105
97
|
}
|
|
@@ -4,8 +4,12 @@
|
|
|
4
4
|
// process it starts inherits: a `npm run verifier` or a circuit that a test plays in a repository
|
|
5
5
|
// of trial neither waits for the lock of the machine nor holds it, and no test writes in the
|
|
6
6
|
// user's cache. A lock already named in the environment stays. Its heavy passes want no room in
|
|
7
|
-
// the temporary directory (GRILLHOUSE_TEMPORAIRE_LIBRE, 0)
|
|
8
|
-
// that plays the file, which
|
|
7
|
+
// the temporary directory (GRILLHOUSE_TEMPORAIRE_LIBRE, 0) nor on the disk of their copy
|
|
8
|
+
// (GRILLHOUSE_COPIE_LIBRE, 0): the room of the machine is the pass's that plays the file, which
|
|
9
|
+
// waited for it.
|
|
10
|
+
//
|
|
11
|
+
// That trial machine takes no place of the user's machine (scripts/places-de-la-machine.mjs): only
|
|
12
|
+
// the server of trial a test names (GRILLHOUSE_PLACES_D_ESSAI).
|
|
9
13
|
import { randomUUID } from 'node:crypto';
|
|
10
14
|
import { tmpdir } from 'node:os';
|
|
11
15
|
import path from 'node:path';
|
|
@@ -15,3 +19,4 @@ process.env.GRILLHOUSE_VERROU_MACHINE ||= path.join(
|
|
|
15
19
|
`grillhouse-mesure-${process.pid}-${randomUUID()}.lock`
|
|
16
20
|
);
|
|
17
21
|
process.env.GRILLHOUSE_TEMPORAIRE_LIBRE ||= '0';
|
|
22
|
+
process.env.GRILLHOUSE_COPIE_LIBRE ||= '0';
|