spec-controller 0.1.171 → 0.1.172

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 -6
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -11613,14 +11613,15 @@ function sharedScnCodesOf(files) {
11613
11613
  function corpusCountsOf(files) {
11614
11614
  const raw = files.reduce((n, f) => n + f.rawScnOccurrences, 0);
11615
11615
  const scenarioCount = files.reduce((n, f) => n + f.taggedScenarios.length, 0);
11616
+ const tagOccurrences = files.reduce((n, f) => n + f.tagScnOccurrences, 0);
11616
11617
  const untagged = files.flatMap(({ feature, untaggedScenarios }) => untaggedScenarios.map((scenario) => ({ feature, scenario }))).sort((a, b) => a.feature.localeCompare(b.feature) || a.scenario.localeCompare(b.scenario));
11617
- return evidenceObligations(raw, scenarioCount, untagged, sharedScnCodesOf(files));
11618
+ return evidenceObligations(raw, scenarioCount, untagged, sharedScnCodesOf(files), tagOccurrences);
11618
11619
  }
11619
- function evidenceObligations(raw, scenarioCount, untaggedScenarios = [], sharedScnCodes = []) {
11620
+ function evidenceObligations(raw, scenarioCount, untaggedScenarios = [], sharedScnCodes = [], tagOccurrences = scenarioCount) {
11620
11621
  return {
11621
11622
  rawScnOccurrences: raw,
11622
11623
  scenarioCount,
11623
- excludedOccurrences: raw - scenarioCount,
11624
+ excludedOccurrences: raw - tagOccurrences,
11624
11625
  untaggedScenarios,
11625
11626
  sharedScnCodes
11626
11627
  };
@@ -11717,23 +11718,32 @@ function gherkinDocumentOf(source) {
11717
11718
  function contentOf({ feature }, source) {
11718
11719
  const scnOccurrences = countScnOccurrences(source);
11719
11720
  if (feature === void 0)
11720
- return { featureCode: null, scenarios: [], scnOccurrences };
11721
+ return { featureCode: null, scenarios: [], scnOccurrences, tagScnOccurrences: 0 };
11721
11722
  const scenarios = [];
11723
+ let tagScnOccurrences = 0;
11724
+ const countTags = (tags) => {
11725
+ tagScnOccurrences += countScnOccurrences(tags.map((t) => t.name).join(" "));
11726
+ };
11722
11727
  const bare = (tags) => tags.map((t) => bareTerm(t.name));
11723
11728
  const collect = (children, inherited) => {
11724
11729
  for (const child of children) {
11725
11730
  if (child.rule) {
11731
+ countTags(child.rule.tags);
11726
11732
  collect(child.rule.children, [...inherited, ...bare(child.rule.tags)]);
11727
11733
  continue;
11728
11734
  }
11729
11735
  if (!child.scenario)
11730
11736
  continue;
11737
+ countTags(child.scenario.tags);
11738
+ for (const examples of child.scenario.examples)
11739
+ countTags(examples.tags);
11731
11740
  scenarios.push({ name: child.scenario.name, tags: [...bare(child.scenario.tags), ...inherited] });
11732
11741
  }
11733
11742
  };
11743
+ countTags(feature.tags);
11734
11744
  const featureTags = bare(feature.tags);
11735
11745
  collect(feature.children, featureTags);
11736
- return { featureCode: headerFeatureCode(featureTags), scenarios, scnOccurrences };
11746
+ return { featureCode: headerFeatureCode(featureTags), scenarios, scnOccurrences, tagScnOccurrences };
11737
11747
  }
11738
11748
  function parseFeatureCorpus(sources) {
11739
11749
  return parseSources(sources, gherkinDocumentOf, contentOf);
@@ -11757,7 +11767,12 @@ function untaggedScenariosOf(feature) {
11757
11767
  }
11758
11768
  function featureCountsOf(feature) {
11759
11769
  const { taggedScenarios, untaggedScenarios } = scenariosByScnCodeOf(feature);
11760
- return { rawScnOccurrences: feature.scnOccurrences, taggedScenarios, untaggedScenarios };
11770
+ return {
11771
+ rawScnOccurrences: feature.scnOccurrences,
11772
+ tagScnOccurrences: feature.tagScnOccurrences,
11773
+ taggedScenarios,
11774
+ untaggedScenarios
11775
+ };
11761
11776
  }
11762
11777
  function corpusCountsOfFeatures(features) {
11763
11778
  return corpusCountsOf(features.map((parsed) => ({ feature: parsed.file, ...featureCountsOf(parsed) })));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-controller",
3
- "version": "0.1.171",
3
+ "version": "0.1.172",
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.171"
29
+ "@3f-consulting/spec-controller-core": "0.1.172"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"