spec-controller 0.1.243 → 0.1.244

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.
Files changed (2) hide show
  1. package/dist/cli.js +21 -10
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -11710,7 +11710,8 @@ function rowClaimsOf(outline, outlineTags) {
11710
11710
  const blockTags = examples.tags.map((tag) => bareTerm(tag.name));
11711
11711
  return examples.tableBody.map((row) => ({
11712
11712
  name: outline.name,
11713
- tags: [...row.cells.filter((_, index) => index === column).flatMap((cell) => rowCodeOf(cell.value)), ...outlineTags, ...blockTags]
11713
+ tags: [...row.cells.filter((_, index) => index === column).flatMap((cell) => rowCodeOf(cell.value)), ...outlineTags, ...blockTags],
11714
+ line: row.location.line
11714
11715
  }));
11715
11716
  });
11716
11717
  }
@@ -11752,6 +11753,14 @@ function contentOf({ feature }, source) {
11752
11753
  function parseFeatureCorpus(sources) {
11753
11754
  return parseSources(sources, gherkinDocumentOf, contentOf);
11754
11755
  }
11756
+ function claimCodesAtOf(features) {
11757
+ const rows = features.flatMap(({ file, scenarios }) => scenarios.map(({ line, tags }) => ({ file: `/${portable(file)}`, line, codes: tags.filter((tag) => SCN_CODE.test(tag)) })));
11758
+ return (path, line) => {
11759
+ const reported2 = `/${portable(path)}`;
11760
+ const matching = rows.filter((row) => row.line === line && reported2.endsWith(row.file));
11761
+ return matching.sort((a, b) => b.file.length - a.file.length)[0]?.codes ?? [];
11762
+ };
11763
+ }
11755
11764
  function scenariosByScnCodeOf({ scenarios }) {
11756
11765
  const taggedScenarios = [];
11757
11766
  const untaggedScenarios = [];
@@ -11789,7 +11798,7 @@ function namedScenariosOf(feature, deferralTags = []) {
11789
11798
  title: scenario.name
11790
11799
  }));
11791
11800
  }
11792
- var SCN_OCCURRENCE, CLAIM_COLUMN;
11801
+ var SCN_OCCURRENCE, CLAIM_COLUMN, portable;
11793
11802
  var init_scenarios = __esm({
11794
11803
  "../core/dist/parse/scenarios.js"() {
11795
11804
  "use strict";
@@ -11803,6 +11812,7 @@ var init_scenarios = __esm({
11803
11812
  init_sourceParse();
11804
11813
  SCN_OCCURRENCE = new RegExp(`@${SCN_ID_SOURCE}`, "g");
11805
11814
  CLAIM_COLUMN = "clm";
11815
+ portable = (path) => path.replaceAll("\\", "/");
11806
11816
  }
11807
11817
  });
11808
11818
 
@@ -12824,13 +12834,14 @@ function ambiguousNote(step) {
12824
12834
  const text = `${(step.keyword ?? "").trim()} ${step.name ?? ""}`.trim();
12825
12835
  return text.length > 0 ? { kind: "ambiguous-step", step: text } : { kind: "ambiguous-step" };
12826
12836
  }
12827
- function parseCucumberEvidenceObservations(report, root) {
12837
+ function parseCucumberEvidenceObservations(report, root, claimCodesAt = () => []) {
12828
12838
  const results = [];
12829
12839
  for (const feature of report) {
12830
12840
  const named = feature.uri ?? feature.name;
12831
12841
  const locator = named && relativizeToRoot(named, root);
12832
12842
  for (const scenario of feature.elements ?? []) {
12833
- results.push(...scenarioObservations(scenario, locator));
12843
+ const rowCodes = locator === void 0 || scenario.line === void 0 ? [] : claimCodesAt(locator, scenario.line);
12844
+ results.push(...scenarioObservations(scenario, locator, rowCodes));
12834
12845
  }
12835
12846
  }
12836
12847
  return results;
@@ -12838,10 +12849,10 @@ function parseCucumberEvidenceObservations(report, root) {
12838
12849
  function citedCodesOf(tagNames) {
12839
12850
  return tagNames.map((name) => SCN_TAG.exec(name)).filter((m) => m !== null).map((m) => m[1]);
12840
12851
  }
12841
- function scenarioObservations(scenario, locator) {
12852
+ function scenarioObservations(scenario, locator, rowCodes) {
12842
12853
  const tagNames = (scenario.tags ?? []).map((t) => withoutSigil(t.name ?? ""));
12843
12854
  const layers = layersPostedAt(tagNames, fallbackLayerOf("scenario-runs"));
12844
- const { claimCode, severalCodes } = attributionOf(citedCodesOf(tagNames));
12855
+ const { claimCode, severalCodes } = attributionOf([...citedCodesOf(tagNames), ...rowCodes]);
12845
12856
  const severalNotes = severalCodes ? [{ kind: "several-claim-codes", codes: severalCodes }] : [];
12846
12857
  const steps = scenario.steps ?? [];
12847
12858
  const evidence = evidenceOfRunResult(runResultOf4(steps));
@@ -32766,8 +32777,8 @@ function featureNamesOf(corpus) {
32766
32777
  function isObservationReader(reader) {
32767
32778
  return Object.hasOwn(OBSERVATION_READERS, reader);
32768
32779
  }
32769
- function observationsOf3(reports, root) {
32770
- return reports.flatMap(({ reader, document }) => isObservationReader(reader) ? OBSERVATION_READERS[reader](document, root) : []);
32780
+ function observationsOf3(reports, root, claimCodesAt) {
32781
+ return reports.flatMap(({ reader, document }) => isObservationReader(reader) ? OBSERVATION_READERS[reader](document, root, claimCodesAt) : []);
32771
32782
  }
32772
32783
  function documentReadBy(reports, reader) {
32773
32784
  return reports.find((report) => report.reader === reader)?.document;
@@ -32779,7 +32790,7 @@ function runReconcile(reports, root, corpus, workflows) {
32779
32790
  packageJson,
32780
32791
  ciWorkflows: workflows,
32781
32792
  ciStepRecord: documentReadBy(reports, "ci-step-record"),
32782
- behaviouralObservations: observationsOf3(reports, root),
32793
+ behaviouralObservations: observationsOf3(reports, root, claimCodesAtOf(corpus)),
32783
32794
  deferralTags: BUILT_IN_DEFERRAL_TAGS,
32784
32795
  reconcilerInvocation: RECONCILER_INVOCATION
32785
32796
  });
@@ -32807,7 +32818,7 @@ var init_ingestQualityChecks = __esm({
32807
32818
  jest: (report, root) => parseVitestEvidenceObservations(report, root),
32808
32819
  junit: (report) => parseJunitEvidenceObservations(report),
32809
32820
  rspec: (report, root) => parseRspecEvidenceObservations(report, root),
32810
- cucumber: (report, root) => parseCucumberEvidenceObservations(report, root)
32821
+ cucumber: (report, root, claimCodesAt) => parseCucumberEvidenceObservations(report, root, claimCodesAt)
32811
32822
  };
32812
32823
  }
32813
32824
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-controller",
3
- "version": "0.1.243",
3
+ "version": "0.1.244",
4
4
  "description": "Reconcile the behaviour your scenarios name against the evidence that actually ran — the deterministic `balance` CLI.",
5
5
  "keywords": [
6
6
  "reconciliation",
@@ -26,7 +26,7 @@
26
26
  "fast-xml-parser": "^5.11.2",
27
27
  "ts-json-schema-generator": "^2.9.0",
28
28
  "yaml": "^2.9.0",
29
- "@3f-consulting/spec-controller-core": "0.1.243"
29
+ "@3f-consulting/spec-controller-core": "0.1.244"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"