@afokapu/atdd-bun 0.10.97 → 0.10.98
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.
|
@@ -12,7 +12,7 @@ if (!report || !Array.isArray(roots) || !roots.length) process.exit(2);
|
|
|
12
12
|
const sourceExtensions = new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".cts", ".mjs", ".cjs"]);
|
|
13
13
|
const testName = /(?:^test_.*|.*(?:\.test|\.spec|\.e2e|_test))\.(?:[cm]?[jt]sx?)$/;
|
|
14
14
|
const violations = [];
|
|
15
|
-
const plans = { acc: new Set(), wmbt: new Set(), train: new Set() };
|
|
15
|
+
const plans = { acc: new Set(), wmbt: new Set(), train: new Set(), journey: new Set() };
|
|
16
16
|
const tests = new Map();
|
|
17
17
|
const declaredAt = new Map();
|
|
18
18
|
const sources = [];
|
|
@@ -36,7 +36,8 @@ function add(rule_id, file, line, evidence, source_line = "") {
|
|
|
36
36
|
function lineOf(content, token) { return lineAt(content, content.indexOf(token)); }
|
|
37
37
|
function lineAt(content, index) { return content.slice(0, index).split("\n").length; }
|
|
38
38
|
// The identity each binding header must carry.
|
|
39
|
-
const PREFIX = { Acceptance: "acc:", WMBT: "wmbt:", Train: "train:" };
|
|
39
|
+
const PREFIX = { Acceptance: "acc:", WMBT: "wmbt:", Train: "train:", Journey: "journey:" };
|
|
40
|
+
const JOURNEY_ID = /^journey:[a-z][a-z0-9-]*$/;
|
|
40
41
|
|
|
41
42
|
for (const root of roots) {
|
|
42
43
|
// `plan_root: .` (or `./`) must still match root-relative paths, which never start with `./`.
|
|
@@ -44,12 +45,16 @@ for (const root of roots) {
|
|
|
44
45
|
walk(root, (path) => {
|
|
45
46
|
const name = path.split("/").pop() || "";
|
|
46
47
|
const content = text(path);
|
|
47
|
-
|
|
48
|
+
const planPath = relative(root, path).replaceAll("\\", "/");
|
|
49
|
+
if (/\.ya?ml$/i.test(name) && planPath.startsWith(planPrefix)) {
|
|
48
50
|
for (const [kind, re] of Object.entries({
|
|
49
51
|
acc: /\bacc:[A-Za-z0-9_.:-]+/g,
|
|
50
52
|
wmbt: /\bwmbt:[A-Za-z0-9_.:-]+/g,
|
|
51
53
|
train: /\btrain:[A-Za-z0-9_.:-]+/g,
|
|
52
54
|
})) for (const match of content.matchAll(re)) plans[kind].add(match[0]);
|
|
55
|
+
if (planPath.startsWith(`${planPrefix}_journeys/`)) {
|
|
56
|
+
for (const match of content.matchAll(/["']?\bjourney_id["']?[ \t]*:[ \t]*["']?(journey:[A-Za-z0-9_.:-]+)/g)) plans.journey.add(match[1]);
|
|
57
|
+
}
|
|
53
58
|
// Where each acceptance is DECLARED (its `urn:` line), so a missing test is reported on the artifact to fix.
|
|
54
59
|
for (const m of content.matchAll(/["']?\burn["']?[ \t]*:[ \t]*["']?(acc:[A-Za-z0-9_.:-]+)/g)) if (!declaredAt.has(m[1])) declaredAt.set(m[1], { path, line: lineAt(content, m.index) });
|
|
55
60
|
return;
|
|
@@ -60,14 +65,14 @@ for (const root of roots) {
|
|
|
60
65
|
const urn = head.match(/^\s*\/\/\s*URN:\s*(test:[^\s]+)/m);
|
|
61
66
|
if (!urn) return;
|
|
62
67
|
// EVERY binding header is judged, not only the first: a valid Acceptance: must not carry an unresolved Train:.
|
|
63
|
-
const headers = [...head.matchAll(/^[ \t]*\/\/[ \t]*(Acceptance|WMBT|Train):[ \t]*(\S*)/gm)].map((m) => ({ kind: m[1], id: m[2], raw: m[0].trim(), line: lineAt(head, m.index) }));
|
|
64
|
-
const bindings = headers.filter((h) => h.id.startsWith(PREFIX[h.kind]));
|
|
68
|
+
const headers = [...head.matchAll(/^[ \t]*\/\/[ \t]*(Acceptance|WMBT|Train|Journey):[ \t]*(\S*)/gm)].map((m) => ({ kind: m[1], id: m[2], raw: m[0].trim(), line: lineAt(head, m.index) }));
|
|
69
|
+
const bindings = headers.filter((h) => h.kind === "Journey" ? JOURNEY_ID.test(h.id) : h.id.startsWith(PREFIX[h.kind]));
|
|
65
70
|
// A test identity may be reused by equivalent smoke harnesses. Preserve every
|
|
66
71
|
// independently declared binding: replacing the earlier record made a valid
|
|
67
72
|
// acceptance disappear solely because a later file had the same test URN.
|
|
68
73
|
const prior = tests.get(urn[1]);
|
|
69
74
|
tests.set(urn[1], { path, bindings: [...(prior?.bindings ?? []), ...bindings] });
|
|
70
|
-
if (!headers.length) add("traceability.test.binding-resolves", path, lineOf(head, urn[0]), "test has a URN but no Acceptance:, WMBT:, or
|
|
75
|
+
if (!headers.length) add("traceability.test.binding-resolves", path, lineOf(head, urn[0]), "test has a URN but no Acceptance:, WMBT:, Train:, or Journey: binding", urn[0]);
|
|
71
76
|
for (const h of headers) if (!bindings.includes(h)) add("traceability.test.binding-resolves", path, h.line, `${h.kind}: ${h.id || "<empty>"} is not a ${PREFIX[h.kind]} identity`, h.raw);
|
|
72
77
|
return;
|
|
73
78
|
}
|
package/integrity.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.10.
|
|
2
|
+
"version": "0.10.98",
|
|
3
3
|
"files": {
|
|
4
4
|
"HOOK_AUDIT.md": "5329d840db37671b1918f688ead26865473b87db73dbc75f7c8b2a8bbe8d6d43",
|
|
5
5
|
"PLANNER_PORT.md": "fb5935bac8b7ac18994de21e43ace3a5ef8cd55f85b0e3349fca261280054f11",
|
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
"detectors/atdd_topology/fixtures/dirty/src/wagons/orders/features/place-order/domain/order.ts": "6fdaad52671ef25b47d93f9b4e97e12c62eb78f5b4cde727435c3ac135a1c0e5",
|
|
192
192
|
"detectors/atdd_topology/fixtures/dirty/tests/wagons/orders/features/place-order/unit/order.test.ts": "f117e6c8b034700e1f00889bea48cb1528f0003d699cfd3e279cd9164b264a38",
|
|
193
193
|
"detectors/atdd_traceability_closure/atdd.implementation.yaml": "82e56cc85539476e42fc8d58e718bc998f1eff6c325a0cd240c0284625834d68",
|
|
194
|
-
"detectors/atdd_traceability_closure/detect.mjs": "
|
|
194
|
+
"detectors/atdd_traceability_closure/detect.mjs": "4fe2f6c73fc5535255f15676fb89f0a887598e3bf80c82f048c8e69432c38342",
|
|
195
195
|
"detectors/atdd_traceability_closure/fixtures/clean/plan/orders/E001.yaml": "0ddad928dde10c2ab690558259a6975125af540a1f30eca9aa0c615bf0ad69fb",
|
|
196
196
|
"detectors/atdd_traceability_closure/fixtures/clean/src/order.ts": "efe6db7e3f723c7b6096abdf58dec9c88b27ec8978d434a10135b3e77bfce321",
|
|
197
197
|
"detectors/atdd_traceability_closure/fixtures/clean/test/order.test.ts": "bee451198d472749616f85c1f1e97c0a06ad28255b9a6a2cc8701bd2e8d56562",
|