@roomi-fields/grillhouse 0.54.0 → 0.55.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +75 -0
- package/cadre/templates/projet/.github/workflows/ci.yml +4 -2
- package/cadre/templates/projet/.github/workflows/machine-vierge.yml +5 -42
- package/cadre/templates/projet/CONTRIBUTING.md +0 -5
- package/cadre/templates/projet/README.md +0 -126
- package/cadre/templates/projet/_npmignore +1 -6
- package/cadre/templates/projet/package.json +5 -32
- package/cadre/templates/projet/tsconfig.json +4 -4
- package/cadre/templates/projet/vitest.config.cjs +3 -2
- package/charte/tests.md +14 -0
- package/dist/machine/part-par-sorte.d.ts +9 -9
- package/dist/machine/part-par-sorte.js +20 -24
- package/dist/machine/part-par-sorte.js.map +1 -1
- package/dist/machine/table-des-consommations.d.ts +65 -0
- package/dist/machine/table-des-consommations.js +94 -0
- package/dist/machine/table-des-consommations.js.map +1 -0
- package/dist/temporal/circuit/activites.d.ts +2 -0
- package/dist/temporal/circuit/activites.js +87 -3
- package/dist/temporal/circuit/activites.js.map +1 -1
- package/dist/temporal/circuit/client.js +9 -4
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +32 -4
- package/dist/temporal/circuit/deroule.js +54 -4
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/circuit/versions.d.ts +12 -0
- package/dist/temporal/circuit/versions.js +22 -0
- package/dist/temporal/circuit/versions.js.map +1 -0
- package/dist/temporal/consommation/activites.d.ts +2 -0
- package/dist/temporal/consommation/activites.js +9 -0
- package/dist/temporal/consommation/activites.js.map +1 -0
- package/dist/temporal/consommation/actualisation.d.ts +2 -0
- package/dist/temporal/consommation/actualisation.js +71 -0
- package/dist/temporal/consommation/actualisation.js.map +1 -0
- package/dist/temporal/consommation/client.d.ts +12 -0
- package/dist/temporal/consommation/client.js +28 -0
- package/dist/temporal/consommation/client.js.map +1 -0
- package/dist/temporal/consommation/commande.d.ts +5 -0
- package/dist/temporal/consommation/commande.js +32 -0
- package/dist/temporal/consommation/commande.js.map +1 -0
- package/dist/temporal/consommation/contrat.d.ts +15 -0
- package/dist/temporal/consommation/contrat.js +13 -0
- package/dist/temporal/consommation/contrat.js.map +1 -0
- package/dist/temporal/consommation/deroule.d.ts +2 -0
- package/dist/temporal/consommation/deroule.js +14 -0
- package/dist/temporal/consommation/deroule.js.map +1 -0
- package/dist/temporal/deroules.d.ts +2 -1
- package/dist/temporal/deroules.js +3 -2
- package/dist/temporal/deroules.js.map +1 -1
- package/dist/temporal/file/contrat.d.ts +2 -0
- package/dist/temporal/file/deroule.js +14 -4
- package/dist/temporal/file/deroule.js.map +1 -1
- package/dist/temporal/installation.d.ts +6 -0
- package/dist/temporal/installation.js +15 -0
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/nuits/activites.d.ts +2 -1
- package/dist/temporal/nuits/activites.js +127 -3
- package/dist/temporal/nuits/activites.js.map +1 -1
- package/dist/temporal/nuits/client.d.ts +19 -5
- package/dist/temporal/nuits/client.js +33 -23
- package/dist/temporal/nuits/client.js.map +1 -1
- package/dist/temporal/nuits/commande.js +16 -11
- package/dist/temporal/nuits/commande.js.map +1 -1
- package/dist/temporal/nuits/contrat.d.ts +29 -0
- package/dist/temporal/nuits/contrat.js +10 -0
- package/dist/temporal/nuits/contrat.js.map +1 -1
- package/dist/temporal/nuits/deroule.d.ts +5 -0
- package/dist/temporal/nuits/deroule.js +18 -1
- package/dist/temporal/nuits/deroule.js.map +1 -1
- package/dist/temporal/nuits/pc2.d.ts +72 -0
- package/dist/temporal/nuits/pc2.js +206 -0
- package/dist/temporal/nuits/pc2.js.map +1 -0
- package/dist/temporal/places/activites.d.ts +23 -1
- package/dist/temporal/places/activites.js +38 -2
- package/dist/temporal/places/activites.js.map +1 -1
- package/dist/temporal/places/client.d.ts +16 -0
- package/dist/temporal/places/client.js +25 -1
- package/dist/temporal/places/client.js.map +1 -1
- package/dist/temporal/places/contrat.d.ts +79 -14
- package/dist/temporal/places/contrat.js +7 -0
- package/dist/temporal/places/contrat.js.map +1 -1
- package/dist/temporal/places/deroule.js +159 -23
- package/dist/temporal/places/deroule.js.map +1 -1
- package/dist/temporal/places/reservation.d.ts +54 -0
- package/dist/temporal/places/reservation.js +69 -0
- package/dist/temporal/places/reservation.js.map +1 -0
- package/dist/temporal/planification.d.ts +6 -0
- package/dist/temporal/planification.js +26 -0
- package/dist/temporal/planification.js.map +1 -0
- package/dist/temporal/tickets/activites.d.ts +0 -2
- package/dist/temporal/tickets/activites.js +2 -52
- package/dist/temporal/tickets/activites.js.map +1 -1
- package/dist/temporal/tickets/contrat.d.ts +7 -26
- package/dist/temporal/tickets/deroule.js +35 -23
- package/dist/temporal/tickets/deroule.js.map +1 -1
- package/dist/temporal/travailleur.js +2 -0
- package/dist/temporal/travailleur.js.map +1 -1
- package/docs/ARCHITECTURE.md +2 -2
- package/docs/CADRE.md +1 -1
- package/docs/INTERFACE.md +16 -11
- package/docs/architecture/circuit.md +62 -58
- package/docs/architecture/entree.md +87 -63
- package/docs/architecture/greffon.md +32 -27
- package/docs/architecture/installation.md +43 -32
- package/docs/architecture/machine.md +48 -40
- package/docs/architecture/tests.md +37 -33
- package/docs/lexique.md +4 -3
- package/package.json +1 -1
- package/scripts/activites.mjs +351 -180
- package/scripts/aiguillage.mjs +1 -0
- package/scripts/attente-de-la-machine.mjs +3 -22
- package/scripts/avancement.mjs +21 -30
- package/scripts/bilan.mjs +22 -2
- package/scripts/branche-de-nuit.mjs +1 -1
- package/scripts/circuit.mjs +75 -39
- package/scripts/codes-de-sortie.mjs +0 -6
- package/scripts/consommation-des-passes.mjs +67 -31
- package/scripts/consommation.mjs +152 -24
- package/scripts/copies-finies.mjs +15 -35
- package/scripts/dernier-vert.mjs +4 -5
- package/scripts/dette.mjs +5 -3
- package/scripts/droits.mjs +2 -2
- package/scripts/echantillonneur-de-la-passe.mjs +7 -31
- package/scripts/engendres.mjs +5 -61
- package/scripts/enveloppe/enveloppe.mjs +30 -34
- package/scripts/enveloppe/travail-de-la-copie.mjs +5 -0
- package/scripts/etapes.mjs +21 -7
- package/scripts/etat-du-depot.mjs +61 -0
- package/scripts/faits-du-circuit.mjs +7 -4
- package/scripts/fermeture-de-la-machine.d.mts +6 -4
- package/scripts/fermeture-de-la-machine.mjs +12 -16
- package/scripts/fichier-du-poste.d.mts +9 -0
- package/scripts/file-des-tickets.d.mts +0 -18
- package/scripts/file-des-tickets.mjs +0 -42
- package/scripts/fusion-du-changelog.mjs +1 -1
- package/scripts/greffons.mjs +282 -17
- package/scripts/grillhouse-maj.mjs +1 -1
- package/scripts/index-des-rouges.d.mts +40 -0
- package/scripts/index-des-rouges.mjs +104 -0
- package/scripts/integration/file.mjs +13 -63
- package/scripts/integration/integrer.mjs +157 -424
- package/scripts/integration/jugement.mjs +109 -0
- package/scripts/integration/rejeu.mjs +94 -71
- package/scripts/jointure.d.ts +34 -27
- package/scripts/journal-des-etats.d.mts +1 -1
- package/scripts/langages/c/commandes.mjs +27 -12
- package/scripts/langages/cargo/commandes.mjs +148 -94
- package/scripts/langages/cargo/index.mjs +2 -1
- package/scripts/langages/cargo/lectures-des-tests.mjs +132 -0
- package/scripts/langages/cargo/migrations/lectures-des-tests.mjs +31 -0
- package/scripts/langages/python/commandes.mjs +31 -15
- package/scripts/langages/python/index.mjs +2 -1
- package/scripts/langages/python/lectures-des-tests.mjs +148 -0
- package/scripts/langages/python/migrations/lectures-des-tests.mjs +31 -0
- package/scripts/langages/typescript/consommateurs-arbitres.mjs +2 -2
- package/scripts/langages/typescript/index.mjs +4 -0
- package/scripts/langages/typescript/lectures-des-tests.mjs +95 -0
- package/scripts/langages/typescript/migrations/lectures-des-tests.mjs +31 -0
- package/scripts/langages/typescript/tests-de-nuit.mjs +9 -15
- package/scripts/langages/typescript/tests.mjs +11 -37
- package/scripts/langages/typescript/titres-de-tests.mjs +5 -4
- package/scripts/langages/typescript/verifier.mjs +74 -44
- package/scripts/langages/typescript/vitest-config/base.mjs +3 -3
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +6 -25
- package/scripts/lectures-communes.mjs +234 -0
- package/scripts/machine.mjs +11 -18
- package/scripts/mesure/base-de-passe.mjs +1 -2
- package/scripts/mesure-de-la-machine.d.mts +40 -3
- package/scripts/mesure-de-la-machine.mjs +201 -11
- package/scripts/migrations/0.33.0-ci-du-cadre.mjs +3 -3
- package/scripts/migrations/nuit-yml-retire.mjs +25 -0
- package/scripts/migrations/part-retiree.mjs +31 -0
- package/scripts/migrations.mjs +4 -0
- package/scripts/montee.mjs +22 -1
- package/scripts/nuit-de-pc2.mjs +628 -0
- package/scripts/nuit.sh +8 -131
- package/scripts/paquets.mjs +1 -1
- package/scripts/passe-de-la-machine.mjs +340 -103
- package/scripts/place-du-circuit.d.mts +15 -0
- package/scripts/place-du-circuit.mjs +32 -0
- package/scripts/places-de-la-machine.mjs +148 -626
- package/scripts/places-du-serveur.mjs +26 -13
- package/scripts/plafond-de-la-machine.d.mts +8 -13
- package/scripts/plafond-de-la-machine.mjs +26 -56
- package/scripts/registre-des-entrees.mjs +57 -0
- package/scripts/regles-des-places.d.mts +82 -50
- package/scripts/regles-des-places.mjs +192 -156
- package/scripts/retirer-copie.sh +9 -2
- package/scripts/seances.mjs +181 -63
- package/scripts/secours.mjs +95 -0
- package/scripts/services-du-noyau.mjs +11 -19
- package/scripts/sous-commandes.mjs +1 -0
- package/scripts/sous-modules.sh +1 -1
- package/scripts/superviseur.mjs +98 -20
- package/scripts/table-des-consommations.d.mts +9 -0
- package/scripts/table-des-consommations.mjs +35 -0
- package/scripts/tableau.mjs +33 -19
- package/scripts/taches-du-graphe.mjs +124 -2
- package/scripts/transitions.d.mts +27 -5
- package/scripts/transitions.mjs +122 -104
- package/scripts/verdict-de-la-nuit.d.mts +13 -0
- package/scripts/verdict-de-la-nuit.mjs +34 -7
- package/scripts/verrou-de-fichier.mjs +1 -2
- package/scripts/workflows-du-cadre.mjs +2 -2
- package/skills/developpeur/SKILL.md +8 -2
- package/skills/direct/SKILL.md +5 -0
- package/skills/explorateur/SKILL.md +10 -1
- package/skills/grill/SKILL.md +2 -4
- package/skills/pitmaster/SKILL.md +14 -7
- package/skills/pitmaster/references/consigne-agent.md +1 -1
- package/skills/relecteur/SKILL.md +4 -1
- package/skills/testwriter/SKILL.md +15 -2
- package/cadre/templates/projet/.env.example +0 -57
- package/cadre/templates/projet/.github/workflows/nuit.yml +0 -139
- package/cadre/templates/projet/deployment/README.md +0 -98
- package/cadre/templates/projet/deployment/docs/01-INSTALL.md +0 -145
- package/cadre/templates/projet/deployment/docs/02-CONFIGURATION.md +0 -117
- package/cadre/templates/projet/deployment/docs/03-API.md +0 -264
- package/cadre/templates/projet/deployment/docs/04-TROUBLESHOOTING.md +0 -262
- package/cadre/templates/projet/deployment/scripts/install.ps1 +0 -100
- package/cadre/templates/projet/deployment/scripts/start.ps1 +0 -61
- package/cadre/templates/projet/deployment/scripts/stop.ps1 +0 -37
- package/cadre/templates/projet/deployment/scripts/test.ps1 +0 -118
- package/cadre/templates/projet/ecosystem.config.cjs +0 -73
- package/cadre/templates/projet/src/config.ts +0 -68
- package/cadre/templates/projet/src/errors.ts +0 -102
- package/cadre/templates/projet/src/index.ts +0 -46
- package/cadre/templates/projet/src/services/.gitkeep +0 -8
- package/cadre/templates/projet/src/types/index.ts +0 -24
- package/cadre/templates/projet/src/utils/logger.ts +0 -106
- package/cadre/templates/projet/tests/unit/config.spec.ts +0 -68
- package/cadre/templates/projet/tests/unit/errors.spec.ts +0 -132
- package/cadre/templates/projet/tests/unit/types.spec.ts +0 -73
- package/cadre/templates/projet/tsconfig.build.json +0 -14
- package/scripts/flux-de-la-nuit.mjs +0 -39
- package/scripts/garde-de-la-memoire.mjs +0 -231
- package/scripts/repli-de-la-nuit.mjs +0 -184
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
//
|
|
6
6
|
// npx grillhouse tests [--force] [<chemin>…] [--<option>…] tester
|
|
7
7
|
// npx grillhouse tests-du-paquet <chemin>… [--<option>…] tests-du-paquet
|
|
8
|
-
// npx grillhouse verifier [--tout | --gardes]
|
|
8
|
+
// npx grillhouse verifier [--tout | --force | --gardes] verifier
|
|
9
9
|
// node commandes.mjs typer typer
|
|
10
10
|
// npx grillhouse tests-de-nuit tests-de-nuit
|
|
11
11
|
// npx grillhouse tailles-des-tests | index-interfaces each guard, its own script
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
// (`*_nuit_test.py`, the one class out of the day: Python has no time budget bench) are left out
|
|
42
42
|
// of every folder, played whole or named (`--ignore-glob`), and a night test named is refused,
|
|
43
43
|
// named, and nothing plays (code 2), as the module cargo's: the night alone plays it. `--force` changes nothing here:
|
|
44
|
-
// pytest keeps no result to replay. Another option goes to pytest. A project played whole (its
|
|
44
|
+
// pytest keeps no result to replay (in `verifier`, `--force` plays the complete pass, as `--tout`). Another option goes to pytest. A project played whole (its
|
|
45
45
|
// own folder named) whose pytest collects no test (code 5) is green, as `cargo test` on a crate
|
|
46
46
|
// without a test and the skeleton typescript's `passWithNoTests`; a path within the project that
|
|
47
47
|
// collects no test stays red, as a run whose paths name no test fails in every language.
|
|
48
48
|
// - `verifier` plays the typing and the tests of the projects as the tasks of Turborepo (`turbo run
|
|
49
49
|
// typecheck test:unit --filter=<projet>…`, the cache of the tasks selecting those that play
|
|
50
|
-
// again; `--tout` plays the tests for real, the moment of the pass in the variable
|
|
50
|
+
// again; `--tout` or `--force` (the night) plays the tests for real, the moment of the pass in the variable
|
|
51
51
|
// `GRILLHOUSE_TESTS`). It keeps no green: the one pass of the verification keeps it
|
|
52
52
|
// (scripts/dernier-vert.mjs, scripts/langages/typescript/verifier.mjs). Beside the module of
|
|
53
53
|
// package.json, whose pass plays every task of the graph, the composed command sets
|
|
@@ -102,6 +102,7 @@ import {
|
|
|
102
102
|
gesteDuPackageJson,
|
|
103
103
|
GRAPHE_JOUE,
|
|
104
104
|
joueCeQuiNeSeDivisePas,
|
|
105
|
+
lancerEntiersEtFichiers,
|
|
105
106
|
lancerLesTaches,
|
|
106
107
|
ligneDesRestes,
|
|
107
108
|
nomDuPaquet,
|
|
@@ -109,6 +110,7 @@ import {
|
|
|
109
110
|
retirerALInterruption,
|
|
110
111
|
SCRIPT_DES_TESTS,
|
|
111
112
|
SCRIPTS_DE_GARDES,
|
|
113
|
+
passeComplete,
|
|
112
114
|
testsCibles,
|
|
113
115
|
travailleursDeLaSeance,
|
|
114
116
|
} from '../../services-du-noyau.mjs';
|
|
@@ -146,6 +148,7 @@ export const CACHE_DE_PYTEST = '.pytest_cache';
|
|
|
146
148
|
/** The guards of the module: each its name and its script beside this one. */
|
|
147
149
|
export const GARDES = [
|
|
148
150
|
{ nom: 'tailles-des-tests', args: [] },
|
|
151
|
+
{ nom: 'lectures-des-tests', args: [] },
|
|
149
152
|
{ nom: 'index-interfaces', args: ['--verifier'] },
|
|
150
153
|
].map(g => ({
|
|
151
154
|
...g,
|
|
@@ -408,16 +411,29 @@ function tester(racine, args, env) {
|
|
|
408
411
|
if (noms.size === 0) {
|
|
409
412
|
return 0;
|
|
410
413
|
}
|
|
411
|
-
return
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
414
|
+
return lancerEntiersEtFichiers({
|
|
415
|
+
chemins: chemins.map(c => path.resolve(racine, c)),
|
|
416
|
+
dossiers: tous.map(c => c.dossier),
|
|
417
|
+
options,
|
|
418
|
+
force: passeComplete(args),
|
|
419
|
+
lancer: ({ chemins: lot, tests }) => {
|
|
420
|
+
const duLot = lot.length
|
|
421
|
+
? nomsDuGraphe(
|
|
422
|
+
racine,
|
|
423
|
+
choisir(racine, tous, lot).choix.map(x => x.c)
|
|
424
|
+
).noms
|
|
425
|
+
: noms;
|
|
426
|
+
return duLot.size
|
|
427
|
+
? lancerLesTaches({
|
|
428
|
+
outil: OUTIL,
|
|
429
|
+
racine,
|
|
430
|
+
taches: [SCRIPT_DES_TESTS],
|
|
431
|
+
noms: duLot,
|
|
432
|
+
tests,
|
|
433
|
+
env,
|
|
434
|
+
})
|
|
435
|
+
: 0;
|
|
436
|
+
},
|
|
421
437
|
});
|
|
422
438
|
}
|
|
423
439
|
|
|
@@ -453,7 +469,7 @@ function testsDuPaquet(racine, args, env) {
|
|
|
453
469
|
}
|
|
454
470
|
|
|
455
471
|
// The pass of `verifier` in <racine>, under the lock of the machine: the typing and the tests of
|
|
456
|
-
// the projects as tasks of Turborepo (the tests played for real with <args> `--tout`). It keeps no
|
|
472
|
+
// the projects as tasks of Turborepo (the tests played for real with <args> `--tout` or `--force`). It keeps no
|
|
457
473
|
// green.
|
|
458
474
|
function verifier(racine, args, env) {
|
|
459
475
|
if (args.includes('--gardes')) {
|
|
@@ -473,7 +489,7 @@ function verifier(racine, args, env) {
|
|
|
473
489
|
racine,
|
|
474
490
|
taches: [TYPAGE, SCRIPT_DES_TESTS],
|
|
475
491
|
noms,
|
|
476
|
-
tests: testsCibles({ arguments: [], force: args
|
|
492
|
+
tests: testsCibles({ arguments: [], force: passeComplete(args) }),
|
|
477
493
|
env,
|
|
478
494
|
});
|
|
479
495
|
if (code !== 0) {
|
|
@@ -52,6 +52,7 @@ import {
|
|
|
52
52
|
import { enRetard, SORTIE } from './index-interfaces.mjs';
|
|
53
53
|
import { elementsDuLot } from './lot.mjs';
|
|
54
54
|
import { miseAJour } from './mise-a-jour.mjs';
|
|
55
|
+
import * as lecturesDesTests from './migrations/lectures-des-tests.mjs';
|
|
55
56
|
import { squelette } from './squelette.mjs';
|
|
56
57
|
import { verdict } from './verdict.mjs';
|
|
57
58
|
|
|
@@ -132,7 +133,7 @@ export default {
|
|
|
132
133
|
],
|
|
133
134
|
entreesDeLIndex,
|
|
134
135
|
gardes: () => GARDES.map(({ script, args }) => [script, ...args]),
|
|
135
|
-
migrations: [],
|
|
136
|
+
migrations: [lecturesDesTests],
|
|
136
137
|
miseAJour,
|
|
137
138
|
squelette,
|
|
138
139
|
};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The readings of a document or of a source by the tests, on the model of « Change-Detector Tests
|
|
3
|
+
// Considered Harmful » (Google): a test proves a behaviour by its interface; one that reads the
|
|
4
|
+
// text of a document or of a file of code detects a change of wording, not a failure. The guard
|
|
5
|
+
// `lectures-des-tests` (packages/grillhouse/docs/architecture/tests.md §3.4).
|
|
6
|
+
//
|
|
7
|
+
// npx grillhouse lectures-des-tests run from the repository root (a guard of grillhouse:gardes)
|
|
8
|
+
//
|
|
9
|
+
// - The test files are those of ./tailles-des-tests.mjs (`tailles`). A finding,
|
|
10
|
+
// `{ fichier, regle: 'lecture-de-document-ou-de-code', message }`, is a test with a call
|
|
11
|
+
// `open(...)`, `<chemin>.read_text()` or `<chemin>.read_bytes()` whose path is a string, a constant
|
|
12
|
+
// of the file, a `Path(...)` or `os.path.join(...)` of strings, or a `/` of such paths, and names
|
|
13
|
+
// an existing `.md` or code file (`.ts`, `.mjs`, `.js`, `.rs`, `.py`, `.sh`) of the repository,
|
|
14
|
+
// resolved from the root or from the directory of the test. A manifest, a datum, a template, a
|
|
15
|
+
// flow of CI, a generated reference and a file the test creates in a temporary folder are no
|
|
16
|
+
// finding; a path built at run time that the guard does not resolve is none either.
|
|
17
|
+
// - A reading allowed carries `# @lit-source: <raison>` in the head comment of the test (the shared
|
|
18
|
+
// judgment: ../../services-du-noyau.mjs, lectures-communes.mjs); a label without a reason is refused.
|
|
19
|
+
// - A finding inscribed in the project's debt (`grillhouse-dette.json`, ../../dette.mjs) passes: those
|
|
20
|
+
// that exist when the guard arrives are inscribed by the update
|
|
21
|
+
// (./migrations/lectures-des-tests.mjs), the count never rises, and a new one is refused.
|
|
22
|
+
import { pathToFileURL } from 'node:url';
|
|
23
|
+
import { trancher } from '../../dette.mjs';
|
|
24
|
+
import { analyse, constatsDesLectures } from '../../services-du-noyau.mjs';
|
|
25
|
+
import { tailles } from './tailles-des-tests.mjs';
|
|
26
|
+
|
|
27
|
+
const { argumentsDuAppel, joindre, litteral, sansCommentaires } = analyse;
|
|
28
|
+
|
|
29
|
+
export const GARDE = 'lectures-des-tests-python';
|
|
30
|
+
|
|
31
|
+
const OUVRIR = /(?<![\w.])open\s*\(/g;
|
|
32
|
+
const LIRE = /\.(?:read_text|read_bytes)\s*\(/g;
|
|
33
|
+
const IDENTIFIANT = /^[A-Za-z_]\w*$/;
|
|
34
|
+
const CHEMIN = /^(?:pathlib\.)?(?:Path|PurePath)\s*\(/;
|
|
35
|
+
const JOINT = /^os\.path\.join\s*\(/;
|
|
36
|
+
|
|
37
|
+
// The top-level split of <e> at the operator `/`.
|
|
38
|
+
function parSlash(e) {
|
|
39
|
+
const parts = [];
|
|
40
|
+
let profondeur = 0;
|
|
41
|
+
let debut = 0;
|
|
42
|
+
for (let i = 0; i < e.length; i++) {
|
|
43
|
+
const ch = e[i];
|
|
44
|
+
if (ch === '"' || ch === "'") {
|
|
45
|
+
i = e.indexOf(ch, i + 1);
|
|
46
|
+
if (i < 0) {
|
|
47
|
+
return [e];
|
|
48
|
+
}
|
|
49
|
+
} else if (ch === '(' || ch === '[') {
|
|
50
|
+
profondeur++;
|
|
51
|
+
} else if (ch === ')' || ch === ']') {
|
|
52
|
+
profondeur--;
|
|
53
|
+
} else if (ch === '/' && profondeur === 0) {
|
|
54
|
+
parts.push(e.slice(debut, i));
|
|
55
|
+
debut = i + 1;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
parts.push(e.slice(debut));
|
|
59
|
+
return parts;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// The path an expression of <texte> names, null when the guard does not resolve it.
|
|
63
|
+
function chemin(expr, texte, profondeur = 0) {
|
|
64
|
+
if (profondeur > 6) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
const e = expr
|
|
68
|
+
.trim()
|
|
69
|
+
.replace(/^str\s*\((.*)\)$/s, '$1')
|
|
70
|
+
.trim();
|
|
71
|
+
const l = litteral(e.replace(/^[rbf]+(?=['"])/i, ''));
|
|
72
|
+
if (l !== null) {
|
|
73
|
+
return l;
|
|
74
|
+
}
|
|
75
|
+
if (IDENTIFIANT.test(e)) {
|
|
76
|
+
const m = new RegExp(`^[ \\t]*${e}[ \\t]*(?::[^=\\n]+)?=[ \\t]*([^\\n=][^\\n]*)$`, 'm').exec(
|
|
77
|
+
texte
|
|
78
|
+
);
|
|
79
|
+
return m ? chemin(m[1], texte, profondeur + 1) : null;
|
|
80
|
+
}
|
|
81
|
+
const slash = parSlash(e);
|
|
82
|
+
if (slash.length > 1) {
|
|
83
|
+
return joindre(slash.map(s => chemin(s, texte, profondeur + 1)));
|
|
84
|
+
}
|
|
85
|
+
const p = CHEMIN.exec(e) ?? JOINT.exec(e);
|
|
86
|
+
if (p && e.endsWith(')')) {
|
|
87
|
+
const args = argumentsDuAppel(e, p[0].length - 1);
|
|
88
|
+
return args.length ? joindre(args.map(a => chemin(a, texte, profondeur + 1))) : null;
|
|
89
|
+
}
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// The receiver of the method whose `.` is at <point> in <texte>: back to the start of its expression.
|
|
94
|
+
function receveur(texte, point) {
|
|
95
|
+
let profondeur = 0;
|
|
96
|
+
let i = point - 1;
|
|
97
|
+
for (; i >= 0; i--) {
|
|
98
|
+
const ch = texte[i];
|
|
99
|
+
if (ch === ')' || ch === ']') {
|
|
100
|
+
profondeur++;
|
|
101
|
+
} else if (ch === '(' || ch === '[') {
|
|
102
|
+
if (profondeur === 0) {
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
profondeur--;
|
|
106
|
+
} else if (profondeur === 0 && (ch === '=' || ch === ',' || ch === '\n' || ch === ':')) {
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return texte.slice(i + 1, point);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** The files <lire> accepts among those the test <texte> reads. */
|
|
114
|
+
function lectures(texte, _test, lire) {
|
|
115
|
+
const c = sansCommentaires(texte, { diese: true });
|
|
116
|
+
const ouverts = [...c.matchAll(OUVRIR)].map(
|
|
117
|
+
m => argumentsDuAppel(c, m.index + m[0].length - 1)[0]
|
|
118
|
+
);
|
|
119
|
+
const lus = [...c.matchAll(LIRE)].map(m => receveur(c, m.index));
|
|
120
|
+
return [...ouverts, ...lus].map(e => {
|
|
121
|
+
const v = e === undefined ? null : chemin(e, c);
|
|
122
|
+
return v === null ? null : lire(v);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The findings of the project at <racine>: one `{ fichier, regle, message }` per test that reads a
|
|
128
|
+
* document or a file of code of the repository, in the debt's form (../../dette.mjs).
|
|
129
|
+
*/
|
|
130
|
+
export function verifier(racine) {
|
|
131
|
+
return constatsDesLectures(
|
|
132
|
+
racine,
|
|
133
|
+
tailles(racine).map(t => t.fichier),
|
|
134
|
+
lectures
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
139
|
+
const racine = process.cwd();
|
|
140
|
+
const { refus, lignes } = trancher(racine, GARDE, verifier(racine));
|
|
141
|
+
for (const r of refus) {
|
|
142
|
+
process.stderr.write(`⛔ ${r.message}\n`);
|
|
143
|
+
}
|
|
144
|
+
for (const l of lignes) {
|
|
145
|
+
process.stderr.write(`${l}\n`);
|
|
146
|
+
}
|
|
147
|
+
process.exitCode = refus.length ? 1 : 0;
|
|
148
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// The migration of the guard of the readings of the tests
|
|
2
|
+
// (scripts/langages/python/lectures-des-tests.mjs): it inscribes the tests that read the content of a
|
|
3
|
+
// document or of a file of code of the repository as the project's known debt (scripts/dette.mjs),
|
|
4
|
+
// frozen: the count never rises and a new one is refused. Migrations:
|
|
5
|
+
// packages/grillhouse/docs/architecture/installation.md §5.4; the guard: tests.md §3.4.
|
|
6
|
+
//
|
|
7
|
+
// - The migration writes the section of the guard in `grillhouse-dette.json` when the guard finds
|
|
8
|
+
// one and the file holds no section of it yet; the rest of the debt stays.
|
|
9
|
+
// - It rewrites no test of the project.
|
|
10
|
+
// - Replayable without effect: once the section is written, nothing.
|
|
11
|
+
import { FICHIER, lire, trancher } from '../../../dette.mjs';
|
|
12
|
+
import { GARDE, verifier } from '../lectures-des-tests.mjs';
|
|
13
|
+
|
|
14
|
+
// Not released yet: the release command numbers it.
|
|
15
|
+
export const version = '0.55.0';
|
|
16
|
+
export const nom = 'lectures des tests';
|
|
17
|
+
|
|
18
|
+
/** Inscribes the readings of a document or of a source by the tests of the project at <projet>; what it did. */
|
|
19
|
+
export function migrer(projet) {
|
|
20
|
+
if (lire(projet)[GARDE]) {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
const constats = verifier(projet);
|
|
24
|
+
if (constats.length === 0) {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
trancher(projet, GARDE, constats, 'inscrire', {});
|
|
28
|
+
return [
|
|
29
|
+
`${FICHIER} : ${constats.length} test(s) qui lisent le contenu d'un document ou d'un fichier de code, inscrit(s) dans la dette de ${GARDE}, gelée ; un neuf est refusé, et un test importe l'interface au lieu de lire un texte`,
|
|
30
|
+
];
|
|
31
|
+
}
|
|
@@ -47,7 +47,7 @@ import path from 'node:path';
|
|
|
47
47
|
import { pathToFileURL } from 'node:url';
|
|
48
48
|
import { lireLigne, matieres } from './consommateurs.mjs';
|
|
49
49
|
import { trancher } from '../../dette.mjs';
|
|
50
|
-
import { arbitrageTranche, estArbitrage } from '../../services-du-noyau.mjs';
|
|
50
|
+
import { arbitrageTranche, baseDuLot, estArbitrage } from '../../services-du-noyau.mjs';
|
|
51
51
|
import { aVerifier, marques, mesureDe } from './interfaces-contre-code.mjs';
|
|
52
52
|
|
|
53
53
|
const REGLE = 'consommateur-sans-arbitrage';
|
|
@@ -145,7 +145,7 @@ export function verifier(racine, env = process.env) {
|
|
|
145
145
|
continue;
|
|
146
146
|
}
|
|
147
147
|
const rel = path.relative(racine, iface);
|
|
148
|
-
const head = git(racine, 'show',
|
|
148
|
+
const head = git(racine, 'show', `${baseDuLot(racine) ?? 'HEAD'}:${rel}`);
|
|
149
149
|
interfaces.push({
|
|
150
150
|
rel,
|
|
151
151
|
avant: head.status === 0 ? head.stdout : null,
|
|
@@ -78,6 +78,7 @@ import * as binaireDeJour from './migrations/0.33.0-binaire-de-jour.mjs';
|
|
|
78
78
|
import * as testsDuPoste from './migrations/0.33.0-tests-du-poste.mjs';
|
|
79
79
|
import * as cacheDesOutils from './migrations/0.34.1-cache-des-outils.mjs';
|
|
80
80
|
import * as testsEquipes from './migrations/0.49.0-tests-equipes.mjs';
|
|
81
|
+
import * as lecturesDeDocuments from './migrations/lectures-des-tests.mjs';
|
|
81
82
|
import * as configurationsEnCommonJs from './migrations/configurations-en-commonjs.mjs';
|
|
82
83
|
import { COMMANDE as COMMANDE_DU_VERROU } from './verrou-des-dependances.mjs';
|
|
83
84
|
|
|
@@ -98,6 +99,7 @@ const OUTILS = [
|
|
|
98
99
|
'frontieres',
|
|
99
100
|
'index-interfaces',
|
|
100
101
|
'interfaces-contre-code',
|
|
102
|
+
'lectures-des-tests',
|
|
101
103
|
'resumes',
|
|
102
104
|
'tailles-des-tests',
|
|
103
105
|
'tests-du-poste',
|
|
@@ -361,6 +363,7 @@ export default {
|
|
|
361
363
|
[ici('tests-du-poste.mjs')],
|
|
362
364
|
[ici('titres-de-tests.mjs')],
|
|
363
365
|
[ici('chemins-des-tests.mjs')],
|
|
366
|
+
[ici('lectures-des-tests.mjs')],
|
|
364
367
|
[ici('resumes.mjs')],
|
|
365
368
|
[ici('verrou-des-dependances.mjs')],
|
|
366
369
|
],
|
|
@@ -378,6 +381,7 @@ export default {
|
|
|
378
381
|
testsDuPoste,
|
|
379
382
|
cacheDesOutils,
|
|
380
383
|
testsEquipes,
|
|
384
|
+
lecturesDeDocuments,
|
|
381
385
|
configurationsEnCommonJs,
|
|
382
386
|
],
|
|
383
387
|
miseAJour: miseAJour(joueDesTests),
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The readings of a document or of a source by the tests, on the model of « Change-Detector Tests
|
|
3
|
+
// Considered Harmful » (Google): a test proves a behaviour by its interface; one that reads the
|
|
4
|
+
// text of a document or of a file of code detects a change of wording, not a failure. The guard
|
|
5
|
+
// `lectures-des-tests` (packages/grillhouse/docs/architecture/tests.md §3.4).
|
|
6
|
+
//
|
|
7
|
+
// npx grillhouse lectures-des-tests run from the repository root (a guard of grillhouse:gardes)
|
|
8
|
+
//
|
|
9
|
+
// - The test files are those of ./tailles-des-tests.mjs (`testsDuDepot`). A finding,
|
|
10
|
+
// `{ fichier, regle: 'lecture-de-document-ou-de-code', message }`, is a test with a call
|
|
11
|
+
// `readFileSync`, `readFile` or `fs.promises.readFile` whose path is a string, a constant of the
|
|
12
|
+
// file, or a `path.join` / `path.resolve` of strings (`__dirname`, `process.cwd()`, constants), and
|
|
13
|
+
// names an existing `.md` or code file (`.ts`, `.mjs`, `.js`, `.rs`, `.py`, `.sh`) of the
|
|
14
|
+
// repository. An import, the launch of a script, a manifest, a datum, a template, a flow of CI, a
|
|
15
|
+
// generated reference and a file the test creates in a temporary folder are no finding; a path
|
|
16
|
+
// built at run time that the guard does not resolve is none either.
|
|
17
|
+
// - A reading allowed carries `@lit-source: <raison>` in the head comment of the test (the shared
|
|
18
|
+
// judgment: ../../services-du-noyau.mjs, lectures-communes.mjs); a label without a reason is refused.
|
|
19
|
+
// - A finding inscribed in the project's debt (`grillhouse-dette.json`, ../../dette.mjs) passes: those
|
|
20
|
+
// that exist when the guard arrives are inscribed by the update
|
|
21
|
+
// (./migrations/lectures-des-tests.mjs), the count never rises, and a new one is refused.
|
|
22
|
+
import { pathToFileURL } from 'node:url';
|
|
23
|
+
import { trancher } from '../../dette.mjs';
|
|
24
|
+
import { analyse, constatsDesLectures } from '../../services-du-noyau.mjs';
|
|
25
|
+
import { testsDuDepot } from './tailles-des-tests.mjs';
|
|
26
|
+
import { code } from './vitest-config/lances.mjs';
|
|
27
|
+
|
|
28
|
+
const { argumentsDuAppel, expressionDepuis, joindre, litteral } = analyse;
|
|
29
|
+
|
|
30
|
+
export const GARDE = 'lectures-des-tests';
|
|
31
|
+
|
|
32
|
+
// A call that reads the content of a file.
|
|
33
|
+
const LECTURE = /(?<![\w$])(?:fs\.promises\.|promises\.|fs\.)?(?:readFileSync|readFile)\s*\(/g;
|
|
34
|
+
const IDENTIFIANT = /^[A-Za-z_$][\w$]*$/;
|
|
35
|
+
const DOSSIER_DU_TEST = /^(?:__dirname|import\.meta\.dirname)$/;
|
|
36
|
+
const RACINE = /^process\.cwd\(\)$/;
|
|
37
|
+
const JOINT = /^(?:path\.)?(?:join|resolve)\s*\(/;
|
|
38
|
+
|
|
39
|
+
// The path an expression of <texte> names, from the directory of the test or the root ('.'), null
|
|
40
|
+
// when the guard does not resolve it.
|
|
41
|
+
function chemin(expr, texte, profondeur = 0) {
|
|
42
|
+
if (profondeur > 6) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
const e = expr.trim();
|
|
46
|
+
const l = litteral(e);
|
|
47
|
+
if (l !== null) {
|
|
48
|
+
return l;
|
|
49
|
+
}
|
|
50
|
+
if (DOSSIER_DU_TEST.test(e) || RACINE.test(e)) {
|
|
51
|
+
return '.';
|
|
52
|
+
}
|
|
53
|
+
if (IDENTIFIANT.test(e)) {
|
|
54
|
+
const m = new RegExp(
|
|
55
|
+
`(?:const|let|var)\\s+${e.replace(/\$/g, '\\$')}\\s*(?::[^=\\n]+)?=\\s*`
|
|
56
|
+
).exec(texte);
|
|
57
|
+
return m ? chemin(expressionDepuis(texte, m.index + m[0].length), texte, profondeur + 1) : null;
|
|
58
|
+
}
|
|
59
|
+
const j = JOINT.exec(e);
|
|
60
|
+
if (j && e.endsWith(')')) {
|
|
61
|
+
const args = argumentsDuAppel(e, j[0].length - 1);
|
|
62
|
+
return args.length ? joindre(args.map(a => chemin(a, texte, profondeur + 1))) : null;
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** The files <lire> accepts among those the test <texte> reads: each path it resolves, from the root. */
|
|
68
|
+
function lectures(texte, _test, lire) {
|
|
69
|
+
const c = code(texte);
|
|
70
|
+
return [...c.matchAll(LECTURE)].map(m => {
|
|
71
|
+
const [premier] = argumentsDuAppel(c, m.index + m[0].length - 1);
|
|
72
|
+
const v = premier === undefined ? null : chemin(premier, c);
|
|
73
|
+
return v === null ? null : lire(v);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The findings of the repository at <racine>: one `{ fichier, regle, message }` per test that
|
|
79
|
+
* reads a document or a file of code of the repository, in the debt's form (../../dette.mjs).
|
|
80
|
+
*/
|
|
81
|
+
export function verifier(racine) {
|
|
82
|
+
return constatsDesLectures(racine, testsDuDepot(racine), lectures);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
86
|
+
const racine = process.cwd();
|
|
87
|
+
const { refus, lignes } = trancher(racine, GARDE, verifier(racine));
|
|
88
|
+
for (const r of refus) {
|
|
89
|
+
process.stderr.write(`⛔ ${r.message}\n`);
|
|
90
|
+
}
|
|
91
|
+
for (const l of lignes) {
|
|
92
|
+
process.stderr.write(`${l}\n`);
|
|
93
|
+
}
|
|
94
|
+
process.exitCode = refus.length ? 1 : 0;
|
|
95
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// The migration of the guard of the readings of the tests
|
|
2
|
+
// (scripts/langages/typescript/lectures-des-tests.mjs): it inscribes the tests that read the content of a
|
|
3
|
+
// document or of a file of code of the repository as the project's known debt (scripts/dette.mjs),
|
|
4
|
+
// frozen: the count never rises and a new one is refused. Migrations:
|
|
5
|
+
// packages/grillhouse/docs/architecture/installation.md §5.4; the guard: tests.md §3.4.
|
|
6
|
+
//
|
|
7
|
+
// - The migration writes the section of the guard in `grillhouse-dette.json` when the guard finds
|
|
8
|
+
// one and the file holds no section of it yet; the rest of the debt stays.
|
|
9
|
+
// - It rewrites no test of the project.
|
|
10
|
+
// - Replayable without effect: once the section is written, nothing.
|
|
11
|
+
import { FICHIER, lire, trancher } from '../../../dette.mjs';
|
|
12
|
+
import { GARDE, verifier } from '../lectures-des-tests.mjs';
|
|
13
|
+
|
|
14
|
+
// Not released yet: the release command numbers it.
|
|
15
|
+
export const version = '0.55.0';
|
|
16
|
+
export const nom = 'lectures des tests';
|
|
17
|
+
|
|
18
|
+
/** Inscribes the readings of a document or of a source by the tests of the project at <projet>; what it did. */
|
|
19
|
+
export function migrer(projet) {
|
|
20
|
+
if (lire(projet)[GARDE]) {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
const constats = verifier(projet);
|
|
24
|
+
if (constats.length === 0) {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
trancher(projet, GARDE, constats, 'inscrire', {});
|
|
28
|
+
return [
|
|
29
|
+
`${FICHIER} : ${constats.length} test(s) qui lisent le contenu d'un document ou d'un fichier de code, inscrit(s) dans la dette de ${GARDE}, gelée ; un neuf est refusé, et un test importe l'interface au lieu de lire un texte`,
|
|
30
|
+
];
|
|
31
|
+
}
|
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
// node tests-de-nuit.mjs from the root of the copy: the night of the poste
|
|
8
8
|
// node tests-de-nuit.mjs --hors-du-poste the night of an equipped runner: all but @poste
|
|
9
9
|
// node tests-de-nuit.mjs --hors-du-poste --sans-equipement all but @poste and @equipee
|
|
10
|
-
// node tests-de-nuit.mjs --du-poste the tests tagged @poste, then the measures of time
|
|
11
|
-
// the project's Nuit flow plays them
|
|
10
|
+
// node tests-de-nuit.mjs --du-poste the tests tagged @poste, then the measures of time
|
|
12
11
|
// node tests-de-nuit.mjs --mesures the benches and the time witnesses alone
|
|
13
12
|
// node tests-de-nuit.mjs --hors-du-poste --tranche i/n its tranche i of n
|
|
14
13
|
//
|
|
@@ -45,10 +44,10 @@
|
|
|
45
44
|
// - The exit code: 0 when every run is green; 75, « à repasser », when every red run is at 75
|
|
46
45
|
// (every failure depended on a duration, one under load, ./vitest-config/duree.reporter.mjs);
|
|
47
46
|
// else the code of the first red run.
|
|
48
|
-
// - The night tests play on the
|
|
49
|
-
// scripts/passe-de-la-machine.mjs, the sort « Nuit
|
|
50
|
-
//
|
|
51
|
-
//
|
|
47
|
+
// - The night tests play on the reservation of the arbiter (`avecLaPasse` of
|
|
48
|
+
// scripts/passe-de-la-machine.mjs, the sort « Nuit », the measures of time « Mesures de nuit »),
|
|
49
|
+
// once the temporary directory and the disk of the copy have room, as every pass: a wait that
|
|
50
|
+
// reaches its bound ends at 75, an arbiter that does not answer ends at 1, named.
|
|
52
51
|
import { spawnSync } from 'node:child_process';
|
|
53
52
|
import { existsSync, readdirSync, rmSync } from 'node:fs';
|
|
54
53
|
import path from 'node:path';
|
|
@@ -56,7 +55,6 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
|
56
55
|
import {
|
|
57
56
|
A_REPASSER,
|
|
58
57
|
avecLaPasse,
|
|
59
|
-
fluxDuProjetJoueLesMesures,
|
|
60
58
|
LA_FORME,
|
|
61
59
|
lireLaTranche,
|
|
62
60
|
} from '../../services-du-noyau.mjs';
|
|
@@ -151,10 +149,8 @@ export function runsDeLaNuit(
|
|
|
151
149
|
: [];
|
|
152
150
|
}
|
|
153
151
|
if (duPoste) {
|
|
154
|
-
// The night of the poste
|
|
155
|
-
const mesures =
|
|
156
|
-
(enTient(racine, estUnBanc) || fichiersTemoins(racine).length > 0) &&
|
|
157
|
-
!fluxDuProjetJoueLesMesures(racine);
|
|
152
|
+
// The night of the poste always plays the measures of time, whatever a flow of the project says.
|
|
153
|
+
const mesures = enTient(racine, estUnBanc) || fichiersTemoins(racine).length > 0;
|
|
158
154
|
return [testsDuPoste(racine).length > 0 && 'du-poste', mesures && 'mesures'].filter(Boolean);
|
|
159
155
|
}
|
|
160
156
|
if (mesuresSeules) {
|
|
@@ -179,15 +175,13 @@ export function testsDeNuit(racine, options = {}) {
|
|
|
179
175
|
if (runs.length === 0) {
|
|
180
176
|
return 0;
|
|
181
177
|
}
|
|
182
|
-
// The night tests play on
|
|
183
|
-
//
|
|
184
|
-
// and the disk of the copy have room.
|
|
178
|
+
// The night tests and the measures of time play on a reservation of the arbiter, as a pass, once
|
|
179
|
+
// the temporary directory and the disk of the copy have room.
|
|
185
180
|
const codes = runs.map(choix => {
|
|
186
181
|
const mesure = choix === 'mesures';
|
|
187
182
|
try {
|
|
188
183
|
return avecLaPasse(() => jouerLeRun(racine, choix, options), {
|
|
189
184
|
lourde: false,
|
|
190
|
-
mesure,
|
|
191
185
|
racine,
|
|
192
186
|
sorte: mesure ? 'Mesures de nuit' : 'Nuit',
|
|
193
187
|
});
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
// removed at the end, green, red or interrupted (SIGINT, SIGTERM, SIGHUP).
|
|
63
63
|
// The exit code is Turborepo's; 2 for a path refused.
|
|
64
64
|
import { spawnSync } from 'node:child_process';
|
|
65
|
-
import {
|
|
65
|
+
import { existsSync, readdirSync, statSync } from 'node:fs';
|
|
66
66
|
import path from 'node:path';
|
|
67
67
|
import {
|
|
68
68
|
AVANCEMENT,
|
|
@@ -71,11 +71,11 @@ import {
|
|
|
71
71
|
DEPUIS_LE_VERT,
|
|
72
72
|
mesure,
|
|
73
73
|
ouvrirBase,
|
|
74
|
-
paquetsDeLEnveloppe,
|
|
75
74
|
retirerALInterruption,
|
|
76
75
|
SCRIPT_DES_TESTS,
|
|
77
76
|
surUnePart,
|
|
78
77
|
TESTS_CIBLES,
|
|
78
|
+
lancerLesTests,
|
|
79
79
|
testsCibles,
|
|
80
80
|
tracesDuPlan,
|
|
81
81
|
} from '../../services-du-noyau.mjs';
|
|
@@ -92,7 +92,6 @@ const racine = process.cwd();
|
|
|
92
92
|
const base = ouvrirBase('tests');
|
|
93
93
|
Object.assign(process.env, base.env);
|
|
94
94
|
const lacher = retirerALInterruption(base.fermer);
|
|
95
|
-
const enveloppe = paquetsDeLEnveloppe() !== null;
|
|
96
95
|
const args = process.argv.slice(2);
|
|
97
96
|
const force = args.includes('--force');
|
|
98
97
|
const options = args.filter(a => a.startsWith('-') && a !== '--force');
|
|
@@ -158,42 +157,17 @@ const traces = (filtres, noms) => {
|
|
|
158
157
|
// The tests <filtres> select, which receive <passes> in VARIABLE: one run with what they depend on;
|
|
159
158
|
// in an envelope, the build of the packages they name with their own traces, then the tests alone.
|
|
160
159
|
// Its exit code: the first that is not 0, else the tests'.
|
|
161
|
-
const cibles = (filtres, passes) =>
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
if (filtres.length === 0 || construits.length > 0) {
|
|
171
|
-
const noms = new Set(construits.map(f => f.slice('--filter='.length)));
|
|
172
|
-
const propres = construits.length ? traces(construits, noms) : { ids: [] };
|
|
173
|
-
if (propres.code !== undefined) {
|
|
174
|
-
return propres.code;
|
|
175
|
-
}
|
|
176
|
-
const construction = turbo(['build', ...propres.ids, '--only', ...construits]);
|
|
177
|
-
if (construction !== 0) {
|
|
178
|
-
return construction;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
return turbo([SCRIPT_DES_TESTS, '--only', ...filtres], tests);
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
// True when this process may write the directory <dir>: false under a read-only mount.
|
|
185
|
-
const inscriptible = dir => {
|
|
186
|
-
try {
|
|
187
|
-
accessSync(dir, constants.W_OK);
|
|
188
|
-
return true;
|
|
189
|
-
} catch {
|
|
190
|
-
return false;
|
|
191
|
-
}
|
|
192
|
-
};
|
|
160
|
+
const cibles = (filtres, passes) =>
|
|
161
|
+
lancerLesTests({
|
|
162
|
+
racine,
|
|
163
|
+
filtres,
|
|
164
|
+
// `testsCibles` is undefined with no path and no `--force`: the variable then stays unset.
|
|
165
|
+
tests: testsCibles({ arguments: passes, force }),
|
|
166
|
+
lancer: (args, tests) => turbo(args, tests),
|
|
167
|
+
traces,
|
|
168
|
+
});
|
|
193
169
|
|
|
194
170
|
const liste = paquets(racine);
|
|
195
|
-
// The directory of each package of the frame, by its name.
|
|
196
|
-
const dossiers = new Map(liste.map(p => [p.pkg.name, path.join(racine, p.dossier)]));
|
|
197
171
|
|
|
198
172
|
// The run the command asks for: its exit code.
|
|
199
173
|
const lancer = () => {
|
|
@@ -31,7 +31,7 @@ import path from 'node:path';
|
|
|
31
31
|
import { pathToFileURL } from 'node:url';
|
|
32
32
|
import { deplacer, FICHIER, lire as lireDette, mesureDuPlan, trancher } from '../../dette.mjs';
|
|
33
33
|
import { A_DEPLACER, A_ELAGUER, ecrireSarif } from '../../resultats.mjs';
|
|
34
|
-
import { prefixe } from '../../services-du-noyau.mjs';
|
|
34
|
+
import { baseDuLot, prefixe } from '../../services-du-noyau.mjs';
|
|
35
35
|
import { testsDuDepot } from './tailles-des-tests.mjs';
|
|
36
36
|
import { TEST } from './vitest-config/lances.mjs';
|
|
37
37
|
|
|
@@ -172,8 +172,9 @@ function ressemblance(a, b) {
|
|
|
172
172
|
* content (or nearly, at least half of the lines kept), are one rename.
|
|
173
173
|
*/
|
|
174
174
|
export function renommesDuLot(racine) {
|
|
175
|
-
const
|
|
176
|
-
const
|
|
175
|
+
const base = baseDuLot(racine) ?? 'HEAD';
|
|
176
|
+
const supprimes = git(racine, ['diff', base, '--name-only', '--diff-filter=D', '-z']);
|
|
177
|
+
const connus = git(racine, ['ls-tree', '-r', '--name-only', base, '-z']);
|
|
177
178
|
if (supprimes.status !== 0 || connus.status !== 0) {
|
|
178
179
|
return {};
|
|
179
180
|
}
|
|
@@ -181,7 +182,7 @@ export function renommesDuLot(racine) {
|
|
|
181
182
|
const avant = new Set(connus.stdout.split('\0'));
|
|
182
183
|
const nouveaux = testsDuDepot(racine).filter(f => !avant.has(f));
|
|
183
184
|
const textesAnciens = new Map(
|
|
184
|
-
anciens.map(f => [f, git(racine, ['show',
|
|
185
|
+
anciens.map(f => [f, git(racine, ['show', `${base}:${f}`]).stdout ?? ''])
|
|
185
186
|
);
|
|
186
187
|
const out = {};
|
|
187
188
|
const pris = new Set();
|