sf-flow-coverage 0.4.1 → 0.5.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +92 -19
  3. package/lib/commands/flowcov/gate.d.ts +3 -0
  4. package/lib/commands/flowcov/gate.js +32 -4
  5. package/lib/commands/flowcov/gate.js.map +1 -1
  6. package/lib/commands/flowcov/readiness.d.ts +1 -0
  7. package/lib/commands/flowcov/readiness.js +16 -4
  8. package/lib/commands/flowcov/readiness.js.map +1 -1
  9. package/lib/commands/flowcov/scaffold.js +5 -1
  10. package/lib/commands/flowcov/scaffold.js.map +1 -1
  11. package/lib/core/apexTemplate.d.ts +9 -1
  12. package/lib/core/apexTemplate.js +188 -19
  13. package/lib/core/apexTemplate.js.map +1 -1
  14. package/lib/core/conditions.d.ts +25 -2
  15. package/lib/core/conditions.js +161 -13
  16. package/lib/core/conditions.js.map +1 -1
  17. package/lib/core/criteria.d.ts +14 -0
  18. package/lib/core/criteria.js +109 -27
  19. package/lib/core/criteria.js.map +1 -1
  20. package/lib/core/exclusions.d.ts +26 -0
  21. package/lib/core/exclusions.js +70 -0
  22. package/lib/core/exclusions.js.map +1 -0
  23. package/lib/core/flowFingerprint.d.ts +6 -0
  24. package/lib/core/flowFingerprint.js +94 -0
  25. package/lib/core/flowFingerprint.js.map +1 -1
  26. package/lib/core/flowGraph.d.ts +13 -0
  27. package/lib/core/flowGraph.js +28 -8
  28. package/lib/core/flowGraph.js.map +1 -1
  29. package/lib/core/flowSettings.d.ts +2 -1
  30. package/lib/core/flowSettings.js.map +1 -1
  31. package/lib/core/flowXml.js +18 -1
  32. package/lib/core/flowXml.js.map +1 -1
  33. package/lib/core/gate.d.ts +3 -0
  34. package/lib/core/gate.js +12 -0
  35. package/lib/core/gate.js.map +1 -1
  36. package/lib/core/lookupFilters.d.ts +33 -0
  37. package/lib/core/lookupFilters.js +139 -0
  38. package/lib/core/lookupFilters.js.map +1 -0
  39. package/lib/core/markdown.d.ts +14 -0
  40. package/lib/core/markdown.js +119 -0
  41. package/lib/core/markdown.js.map +1 -0
  42. package/lib/core/requiredFields.d.ts +19 -0
  43. package/lib/core/requiredFields.js +40 -0
  44. package/lib/core/requiredFields.js.map +1 -1
  45. package/lib/core/scaffold.d.ts +6 -0
  46. package/lib/core/scaffold.js +72 -3
  47. package/lib/core/scaffold.js.map +1 -1
  48. package/lib/core/toolingQuery.js.map +1 -1
  49. package/lib/core/types.d.ts +2 -0
  50. package/lib/core/validationRules.d.ts +14 -0
  51. package/lib/core/validationRules.js +30 -0
  52. package/lib/core/validationRules.js.map +1 -0
  53. package/lib/index.d.ts +4 -0
  54. package/lib/index.js +2 -0
  55. package/lib/index.js.map +1 -1
  56. package/messages/flowcov.gate.md +28 -1
  57. package/messages/flowcov.readiness.md +12 -0
  58. package/messages/flowcov.scaffold.md +1 -1
  59. package/oclif.manifest.json +40 -4
  60. package/package.json +1 -1
@@ -15,8 +15,27 @@ function objectsToCreate(flow) {
15
15
  .map((v) => v.objectType);
16
16
  if ((kind === 'record' || kind === 'platformEvent') && flow.object)
17
17
  objects.push(flow.object);
18
+ // A text input the Flow filters records by (`Id = {!recordId}`) gets a record of that object.
19
+ for (const filter of idInputFilters(flow))
20
+ if (filter.field === 'Id')
21
+ objects.push(filter.object);
18
22
  return objects;
19
23
  }
24
+ /** Filters that compare a field with one of the Flow's text input variables. */
25
+ function idInputFilters(flow) {
26
+ if (flowKind(flow) !== 'autolaunched')
27
+ return [];
28
+ const inputs = new Set(flow.variables
29
+ .filter((v) => v.isInput && !v.isCollection && ['String', 'Text'].includes(v.dataType))
30
+ .map((v) => v.name));
31
+ return (flow.graph?.idFilters ?? []).filter((f) => inputs.has(f.variable));
32
+ }
33
+ /** Objects filtered by a lookup field compared with a text input, to learn what the lookup points to. */
34
+ function idInputLookupObjects(flow) {
35
+ return idInputFilters(flow)
36
+ .filter((f) => f.field !== 'Id')
37
+ .map((f) => f.object);
38
+ }
20
39
  /**
21
40
  * Lookup fields the entry criteria read on the triggering record: lookups compared directly
22
41
  * (`Account__c`) and the lookups behind related fields (`Account__r.Type`).
@@ -38,6 +57,12 @@ function criteriaLookups(flow, relationships) {
38
57
  function parentObjects(flows, fields) {
39
58
  const parents = [];
40
59
  for (const flow of flows) {
60
+ // An input compared with a lookup field holds an Id of the lookup's target.
61
+ for (const filter of idInputFilters(flow).filter((f) => f.field !== 'Id')) {
62
+ const target = fields.lookups[filter.object]?.[filter.field];
63
+ if (target && canInsertParent(target))
64
+ parents.push(target);
65
+ }
41
66
  for (const object of objectsToCreate(flow)) {
42
67
  const criteria = object === flow.object ? criteriaLookups(flow, fields.relationships[object] ?? {}) : new Set();
43
68
  for (const [field, target] of Object.entries(fields.lookups[object] ?? {})) {
@@ -55,6 +80,28 @@ function grandparentObjects(objects, fields) {
55
80
  .filter(([field, target]) => field in (fields.requiredFields[object] ?? {}) && canInsertParent(target))
56
81
  .map(([, target]) => target));
57
82
  }
83
+ /**
84
+ * Objects along the entry criteria's relationship paths (`Contact__r.Account.Type` reaches
85
+ * Contact, then Account), as far as the described objects go.
86
+ */
87
+ function criteriaPathObjects(flows, fields) {
88
+ const objects = [];
89
+ for (const flow of flows) {
90
+ if (!flow.object)
91
+ continue;
92
+ for (const path of fieldPaths(entryCondition(flow))) {
93
+ let object = flow.object;
94
+ for (const relationship of path.slice(0, Math.min(path.length - 1, MAX_PARENT_DEPTH))) {
95
+ const target = fields.lookups[object]?.[fields.relationships[object]?.[relationship] ?? ''];
96
+ if (!target || !canInsertParent(target))
97
+ break;
98
+ objects.push(target);
99
+ object = target;
100
+ }
101
+ }
102
+ }
103
+ return objects;
104
+ }
58
105
  async function exists(path) {
59
106
  try {
60
107
  await access(path);
@@ -98,16 +145,38 @@ export async function scaffoldTests(options) {
98
145
  }
99
146
  const objectFields = emptyObjectFields();
100
147
  if (options.describe) {
101
- await loadObjectFields(flows.flatMap((f) => objectsToCreate(f.flow)), options.describe, objectFields);
148
+ await loadObjectFields(flows.flatMap((f) => [...objectsToCreate(f.flow), ...idInputLookupObjects(f.flow)]), options.describe, objectFields);
102
149
  let level = parentObjects(flows.map((f) => f.flow), objectFields);
103
150
  for (let depth = 1; depth <= MAX_PARENT_DEPTH && level.length > 0; depth++) {
104
151
  const fresh = [...new Set(level)].filter((object) => !(object in objectFields.requiredFields));
105
152
  await loadObjectFields(fresh, options.describe, objectFields);
106
- level = grandparentObjects(fresh, objectFields);
153
+ level = [
154
+ ...grandparentObjects(fresh, objectFields),
155
+ ...criteriaPathObjects(flows.map((f) => f.flow), objectFields),
156
+ ].filter((object) => !(object in objectFields.requiredFields));
157
+ }
158
+ }
159
+ const validationRules = {};
160
+ if (options.validationRules) {
161
+ // Sequential on purpose: one Tooling API query per object, then one per rule.
162
+ for (const object of Object.keys(objectFields.requiredFields)) {
163
+ const rules = await options.validationRules(object);
164
+ if (rules.length > 0)
165
+ validationRules[object] = rules;
166
+ }
167
+ }
168
+ const lookupFilters = {};
169
+ if (options.lookupFilters) {
170
+ for (const [object, lookups] of Object.entries(objectFields.filteredLookups)) {
171
+ if (lookups.length === 0)
172
+ continue;
173
+ const filters = await options.lookupFilters(object, lookups);
174
+ if (filters.length > 0)
175
+ lookupFilters[object] = filters;
107
176
  }
108
177
  }
109
178
  for (const { flowName, flow } of flows) {
110
- const test = generateApexTest(flow, objectFields);
179
+ const test = generateApexTest(flow, { ...objectFields, validationRules, lookupFilters });
111
180
  const classPath = join(outputDir, `${test.className}.cls`);
112
181
  if (!options.force && (await exists(classPath))) {
113
182
  result.skipped.push({ flowName, reason: `${classPath} already exists. Use --force to overwrite.` });
@@ -1 +1 @@
1
- {"version":3,"file":"scaffold.js","sourceRoot":"","sources":["../../src/core/scaffold.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,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,OAAO,CAAC;AACxF,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,YAAY,CAAC,UAAwC;IACnE,OAAO,KAAK,EAAE,IAAY,EAAE,QAA2B,EAAoB,EAAE,CAC3E,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAqD,EAAE,QAAkB,CAAC,CAAC;AACxG,CAAC;AAED,kGAAkG;AAClG,MAAM,UAAU,cAAc,CAAC,UAAwC;IACrE,OAAO,KAAK,EAAE,UAAkB,EAA2B,EAAE;QAC3D,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QACrD,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAoC,EAAE,eAAe,EAAE,MAAM,CAAC,eAAe,EAAE,CAAC;IAC1G,CAAC,CAAC;AACJ,CAAC"}
@@ -103,6 +103,8 @@ export type FlowMetadata = {
103
103
  filterFormula?: string;
104
104
  /** The Flow's elements, for working out what a test can assert. */
105
105
  graph?: FlowGraph;
106
+ /** Fields the Flow reads from each record variable, by variable name. */
107
+ recordReads?: Record<string, string[]>;
106
108
  variables: FlowVariable[];
107
109
  };
108
110
  export type ReadinessFlow = {
@@ -0,0 +1,14 @@
1
+ import type { ToolingQuery } from './types.js';
2
+ /** An active validation rule: its name, error condition formula, and message. */
3
+ export type ValidationRule = {
4
+ name: string;
5
+ formula: string;
6
+ message?: string;
7
+ };
8
+ /** Reads the active validation rules of an object. Empty when they can't be read. */
9
+ export type ReadValidationRules = (object: string) => Promise<ValidationRule[]>;
10
+ /**
11
+ * Reads validation rules through the Tooling API. The error condition formula is only in a
12
+ * rule's `Metadata`, which the Tooling API returns one row at a time, so each rule takes a query.
13
+ */
14
+ export declare function validationRuleReader(query: ToolingQuery): ReadValidationRules;
@@ -0,0 +1,30 @@
1
+ const quote = (value) => `'${value.replace(/\\/g, '\\\\').replace(/'/g, "\\'")}'`;
2
+ /**
3
+ * Reads validation rules through the Tooling API. The error condition formula is only in a
4
+ * rule's `Metadata`, which the Tooling API returns one row at a time, so each rule takes a query.
5
+ */
6
+ export function validationRuleReader(query) {
7
+ return async (object) => {
8
+ let rules;
9
+ try {
10
+ rules = await query(`SELECT Id, ValidationName, ErrorMessage FROM ValidationRule WHERE Active = true AND EntityDefinition.QualifiedApiName = ${quote(object)}`);
11
+ }
12
+ catch {
13
+ return [];
14
+ }
15
+ const result = [];
16
+ for (const rule of rules) {
17
+ try {
18
+ const [record] = await query(`SELECT Metadata FROM ValidationRule WHERE Id = ${quote(rule.Id)}`);
19
+ const formula = record?.Metadata?.errorConditionFormula;
20
+ if (formula)
21
+ result.push({ name: rule.ValidationName, formula, message: rule.ErrorMessage ?? undefined });
22
+ }
23
+ catch {
24
+ // A rule whose formula can't be read is left out.
25
+ }
26
+ }
27
+ return result;
28
+ };
29
+ }
30
+ //# sourceMappingURL=validationRules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validationRules.js","sourceRoot":"","sources":["../../src/core/validationRules.ts"],"names":[],"mappings":"AAQA,MAAM,KAAK,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC;AAIlG;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAmB;IACtD,OAAO,KAAK,EAAE,MAAM,EAAE,EAAE;QACtB,IAAI,KAAmB,CAAC;QACxB,IAAI,CAAC;YACH,KAAK,GAAG,MAAM,KAAK,CACjB,2HAA2H,KAAK,CAAC,MAAM,CAAC,EAAE,CAC3I,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,MAAM,MAAM,GAAqB,EAAE,CAAC;QACpC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,CAAC;gBACH,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,KAAK,CAC1B,kDAAkD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CACnE,CAAC;gBACF,MAAM,OAAO,GAAG,MAAM,EAAE,QAAQ,EAAE,qBAAqB,CAAC;gBACxD,IAAI,OAAO;oBAAE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,YAAY,IAAI,SAAS,EAAE,CAAC,CAAC;YAC5G,CAAC;YAAC,MAAM,CAAC;gBACP,kDAAkD;YACpD,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC"}
package/lib/index.d.ts CHANGED
@@ -1,11 +1,15 @@
1
1
  export { apexClassMetaXml, apexTestClassName, generateApexTest } from './core/apexTemplate.js';
2
2
  export type { CoverageFormat } from './core/coverageFormats.js';
3
3
  export { COVERAGE_FORMATS, formatCoverage } from './core/coverageFormats.js';
4
+ export type { Exclusion } from './core/exclusions.js';
5
+ export { findExclusion, IGNORE_FILE, parseIgnoreFile, readIgnoreFile } from './core/exclusions.js';
4
6
  export type { DataQuery, MetadataRead } from './core/flowSettings.js';
5
7
  export { COUNTED_PROCESS_TYPES, DEFAULT_THRESHOLD, isCountedProcessType } from './core/flowTypes.js';
6
8
  export { parseFlowXml } from './core/flowXml.js';
7
9
  export type { GateCandidate, GateOptions } from './core/gate.js';
8
10
  export { collectChangedFlows, evaluateGate } from './core/gate.js';
11
+ export type { OutputFormat } from './core/markdown.js';
12
+ export { gateMarkdown, OUTPUT_FORMATS, readinessMarkdown } from './core/markdown.js';
9
13
  export { OrgCoverageSource } from './core/orgCoverageSource.js';
10
14
  export type { ReadinessOptions } from './core/readiness.js';
11
15
  export { buildReadinessReport } from './core/readiness.js';
package/lib/index.js CHANGED
@@ -1,8 +1,10 @@
1
1
  export { apexClassMetaXml, apexTestClassName, generateApexTest } from './core/apexTemplate.js';
2
2
  export { COVERAGE_FORMATS, formatCoverage } from './core/coverageFormats.js';
3
+ export { findExclusion, IGNORE_FILE, parseIgnoreFile, readIgnoreFile } from './core/exclusions.js';
3
4
  export { COUNTED_PROCESS_TYPES, DEFAULT_THRESHOLD, isCountedProcessType } from './core/flowTypes.js';
4
5
  export { parseFlowXml } from './core/flowXml.js';
5
6
  export { collectChangedFlows, evaluateGate } from './core/gate.js';
7
+ export { gateMarkdown, OUTPUT_FORMATS, readinessMarkdown } from './core/markdown.js';
6
8
  export { OrgCoverageSource } from './core/orgCoverageSource.js';
7
9
  export { buildReadinessReport } from './core/readiness.js';
8
10
  export { requiredFieldValues } from './core/requiredFields.js';
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/F,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE7E,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACrG,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAO/F,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/F,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE7E,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEnG,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACrG,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAO/F,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -10,7 +10,9 @@ Coverage is read from FlowTestCoverage in the target org. Deploy the branch to t
10
10
 
11
11
  The gate also fails a Flow when the org has no active version of it, or when its active version is older than its latest version. Both usually mean the branch was deployed inactive, so the org's coverage doesn't belong to the version in the pull request.
12
12
 
13
- With --from, the gate also compares each changed Flow at --to with the org's version: process type, start trigger and entry criteria, and the names of its elements and resources. A difference usually means the branch wasn't deployed to the org. By default this is a warning; use --content-check to fail instead, or to skip the comparison. The comparison doesn't look inside elements, so it can miss a change that only edits an existing element.
13
+ With --from, the gate also compares each changed Flow at --to with the org's version: its process type, start element and entry criteria, Flow properties such as the API version and label, and each element and resource: which ones exist and what each one contains, such as a decision's conditions or an assignment's values. Canvas positions and Flow Builder's own settings are ignored. A difference usually means the branch wasn't deployed to the org. By default this is a warning; use --content-check to fail instead, or to skip the comparison.
14
+
15
+ To leave out Flows a team has chosen not to test yet, such as legacy Flows, list them in a `.flowcovignore` file in --project-dir or pass --exclude. Excluded Flows are skipped, with the pattern that matched them as the reason. Exclusions only affect the gate: Salesforce still counts every active Flow toward the org-wide total that `sf flowcov readiness` reports.
14
16
 
15
17
  For a Flow that tests run only in part, the --json output lists the elements no test runs, and a Flow that fails --min-element-coverage names them in its reason.
16
18
 
@@ -30,6 +32,10 @@ Exits with code 1 when any Flow fails.
30
32
 
31
33
  <%= config.bin %> <%= command.id %> --target-org ci-sandbox --from origin/main --content-check fail
32
34
 
35
+ - Skip legacy Flows, and add the results to a GitHub Actions job summary:
36
+
37
+ <%= config.bin %> <%= command.id %> --target-org ci-sandbox --from origin/main --exclude "Legacy_*" --output-format markdown >> "$GITHUB_STEP_SUMMARY"
38
+
33
39
  - Check named Flows without git:
34
40
 
35
41
  <%= config.bin %> <%= command.id %> --target-org ci-sandbox --flow Account_After_Save --flow Close_Cases
@@ -62,6 +68,27 @@ What to do when a changed Flow's content differs from the org's version.
62
68
 
63
69
  "warn" prints a warning, "fail" fails a Flow that would otherwise pass, and "off" skips the comparison (and its one Tooling API query per Flow). Only applies with --from.
64
70
 
71
+ # flags.exclude.summary
72
+
73
+ Flow API name or file path pattern for a Flow the gate skips.
74
+
75
+ # flags.exclude.description
76
+
77
+ A pattern without "/" matches Flow API names, ignoring case; a pattern with "/" matches file paths from the repository root. "*" matches any characters except "/", "**" matches any characters, and "?" matches one character. A path ending in "/" matches everything under it. Patterns add to those in .flowcovignore, which lists one pattern per line with an optional "# reason" after it:
78
+
79
+ # Deferred until the Q3 rewrite
80
+ Legacy_*
81
+ Close_Old_Cases # replaced by Case_Closure next release
82
+ force-app/main/legacy/
83
+
65
84
  # error.noInput
66
85
 
67
86
  Provide --from to check changed Flows, or --flow to check named Flows.
87
+
88
+ # flags.output-format.summary
89
+
90
+ Format of the report printed to standard output.
91
+
92
+ # flags.output-format.description
93
+
94
+ "human" prints tables and warnings to the terminal. "markdown" prints the results as one Markdown document, warnings included, for a pull request comment or a GitHub Actions job summary. Redirect it to a file, for example `>> "$GITHUB_STEP_SUMMARY"`. --json takes precedence over both.
@@ -24,6 +24,10 @@ The report also says whether "Deploy processes and flows as active" is already o
24
24
 
25
25
  <%= config.bin %> <%= command.id %> --target-org prod --fail-if-not-ready
26
26
 
27
+ - Add the report to a GitHub Actions job summary:
28
+
29
+ <%= config.bin %> <%= command.id %> --target-org prod --output-format markdown >> "$GITHUB_STEP_SUMMARY"
30
+
27
31
  # flags.project-dir.summary
28
32
 
29
33
  Git repository used to rank uncovered Flows by how often they change.
@@ -39,3 +43,11 @@ Coverage percentage the org must reach.
39
43
  # flags.fail-if-not-ready.summary
40
44
 
41
45
  Exit with code 1 when the org is below the threshold.
46
+
47
+ # flags.output-format.summary
48
+
49
+ Format of the report printed to standard output.
50
+
51
+ # flags.output-format.description
52
+
53
+ "human" prints tables and warnings to the terminal. "markdown" prints the report as one Markdown document, warnings included, for a pull request comment or a GitHub Actions job summary. Redirect it to a file, for example `>> "$GITHUB_STEP_SUMMARY"`. --json takes precedence over both.
@@ -4,7 +4,7 @@ Generate starter Apex tests for Flows.
4
4
 
5
5
  # description
6
6
 
7
- Reads each Flow's metadata file from the project and writes an Apex test class named `<Flow>_FlowTest` that runs it: record-triggered Flows get a record built from the trigger object and entry criteria, autolaunched Flows are started with Flow.Interview and their input variables, and platform event Flows publish the event. When a target org is available (--target-org or a default org), the command describes each object the test creates and fills in its required fields, the fields the entry criteria need, and parent records (and their parents) for required lookups.
7
+ Reads each Flow's metadata file from the project and writes an Apex test class named `<Flow>_FlowTest` that runs it: record-triggered Flows get a record built from the trigger object and entry criteria, autolaunched Flows are started with Flow.Interview and their input variables, and platform event Flows publish the event. When a target org is available (--target-org or a default org), the command describes each object the test creates and fills in its required fields, the fields the entry criteria need, and parent records (and their parents) for required lookups. It also reads each object's active validation rules: a record the test saves (the triggering record on insert and on update, parents, and input records) gets the field values that keep a rule from blocking it, and a rule it can't avoid gets a TODO that names it. Required lookup filters (on standard and custom lookups) are met the same way: a parent record the test inserts gets the field values the filter needs.
8
8
 
9
9
  Entry criteria are read as one condition, whether they are filters (with AND, OR, or custom logic) or a formula. The command meets one branch of an OR, and handles comparisons with literals, other fields, `$User.Id`, and `TODAY()`; `$Record__Prior` values in update tests; and fields on related records, which it sets on the parent record it inserts.
10
10
 
@@ -3,11 +3,12 @@
3
3
  "flowcov:gate": {
4
4
  "aliases": [],
5
5
  "args": {},
6
- "description": "Salesforce only checks that the org-wide total stays at or above 75%, so a single Flow with no tests can still be deployed as active. This gate checks each changed Flow on its own: every active autolaunched Flow or process changed between --from and --to must be run by at least one Apex test, and optionally reach a minimum element coverage.\n\nCoverage is read from FlowTestCoverage in the target org. Deploy the branch to the target org and run Apex tests there with `sf apex run test --code-coverage` before running the gate. Without `--code-coverage`, Salesforce records no Flow coverage. When no Flow in the org has any coverage recorded, the command warns that the tests most likely ran without `--code-coverage`. Flows that don't count toward deploy-as-active (screen Flows, inactive Flows) are skipped.\n\nThe gate also fails a Flow when the org has no active version of it, or when its active version is older than its latest version. Both usually mean the branch was deployed inactive, so the org's coverage doesn't belong to the version in the pull request.\n\nWith --from, the gate also compares each changed Flow at --to with the org's version: process type, start trigger and entry criteria, and the names of its elements and resources. A difference usually means the branch wasn't deployed to the org. By default this is a warning; use --content-check to fail instead, or to skip the comparison. The comparison doesn't look inside elements, so it can miss a change that only edits an existing element.\n\nFor a Flow that tests run only in part, the --json output lists the elements no test runs, and a Flow that fails --min-element-coverage names them in its reason.\n\nExits with code 1 when any Flow fails.",
6
+ "description": "Salesforce only checks that the org-wide total stays at or above 75%, so a single Flow with no tests can still be deployed as active. This gate checks each changed Flow on its own: every active autolaunched Flow or process changed between --from and --to must be run by at least one Apex test, and optionally reach a minimum element coverage.\n\nCoverage is read from FlowTestCoverage in the target org. Deploy the branch to the target org and run Apex tests there with `sf apex run test --code-coverage` before running the gate. Without `--code-coverage`, Salesforce records no Flow coverage. When no Flow in the org has any coverage recorded, the command warns that the tests most likely ran without `--code-coverage`. Flows that don't count toward deploy-as-active (screen Flows, inactive Flows) are skipped.\n\nThe gate also fails a Flow when the org has no active version of it, or when its active version is older than its latest version. Both usually mean the branch was deployed inactive, so the org's coverage doesn't belong to the version in the pull request.\n\nWith --from, the gate also compares each changed Flow at --to with the org's version: its process type, start element and entry criteria, Flow properties such as the API version and label, and each element and resource: which ones exist and what each one contains, such as a decision's conditions or an assignment's values. Canvas positions and Flow Builder's own settings are ignored. A difference usually means the branch wasn't deployed to the org. By default this is a warning; use --content-check to fail instead, or to skip the comparison.\n\nTo leave out Flows a team has chosen not to test yet, such as legacy Flows, list them in a `.flowcovignore` file in --project-dir or pass --exclude. Excluded Flows are skipped, with the pattern that matched them as the reason. Exclusions only affect the gate: Salesforce still counts every active Flow toward the org-wide total that `sf flowcov readiness` reports.\n\nFor a Flow that tests run only in part, the --json output lists the elements no test runs, and a Flow that fails --min-element-coverage names them in its reason.\n\nExits with code 1 when any Flow fails.",
7
7
  "examples": [
8
8
  "Check the Flows changed in a pull request:\n<%= config.bin %> <%= command.id %> --target-org ci-sandbox --from origin/main --to HEAD",
9
9
  "Also require 60% element coverage per Flow:\n<%= config.bin %> <%= command.id %> --target-org ci-sandbox --from origin/main --min-element-coverage 60",
10
10
  "Fail when the org runs a different version of a changed Flow than the branch:\n<%= config.bin %> <%= command.id %> --target-org ci-sandbox --from origin/main --content-check fail",
11
+ "Skip legacy Flows, and add the results to a GitHub Actions job summary:\n<%= config.bin %> <%= command.id %> --target-org ci-sandbox --from origin/main --exclude \"Legacy_*\" --output-format markdown >> \"$GITHUB_STEP_SUMMARY\"",
11
12
  "Check named Flows without git:\n<%= config.bin %> <%= command.id %> --target-org ci-sandbox --flow Account_After_Save --flow Close_Cases"
12
13
  ],
13
14
  "flags": {
@@ -101,6 +102,27 @@
101
102
  "off"
102
103
  ],
103
104
  "type": "option"
105
+ },
106
+ "exclude": {
107
+ "description": "A pattern without \"/\" matches Flow API names, ignoring case; a pattern with \"/\" matches file paths from the repository root. \"*\" matches any characters except \"/\", \"**\" matches any characters, and \"?\" matches one character. A path ending in \"/\" matches everything under it. Patterns add to those in .flowcovignore, which lists one pattern per line with an optional \"# reason\" after it:\n\n # Deferred until the Q3 rewrite\n Legacy_*\n Close_Old_Cases # replaced by Case_Closure next release\n force-app/main/legacy/",
108
+ "name": "exclude",
109
+ "summary": "Flow API name or file path pattern for a Flow the gate skips.",
110
+ "hasDynamicHelp": false,
111
+ "multiple": true,
112
+ "type": "option"
113
+ },
114
+ "output-format": {
115
+ "description": "\"human\" prints tables and warnings to the terminal. \"markdown\" prints the results as one Markdown document, warnings included, for a pull request comment or a GitHub Actions job summary. Redirect it to a file, for example `>> \"$GITHUB_STEP_SUMMARY\"`. --json takes precedence over both.",
116
+ "name": "output-format",
117
+ "summary": "Format of the report printed to standard output.",
118
+ "default": "human",
119
+ "hasDynamicHelp": false,
120
+ "multiple": false,
121
+ "options": [
122
+ "human",
123
+ "markdown"
124
+ ],
125
+ "type": "option"
104
126
  }
105
127
  },
106
128
  "hasDynamicHelp": true,
@@ -132,7 +154,8 @@
132
154
  "examples": [
133
155
  "Report readiness for the default org:\n<%= config.bin %> <%= command.id %>",
134
156
  "Rank uncovered Flows by changes in the last 6 months:\n<%= config.bin %> <%= command.id %> --target-org prod --since \"6 months ago\"",
135
- "Fail a CI job unless the org is at or above 75%:\n<%= config.bin %> <%= command.id %> --target-org prod --fail-if-not-ready"
157
+ "Fail a CI job unless the org is at or above 75%:\n<%= config.bin %> <%= command.id %> --target-org prod --fail-if-not-ready",
158
+ "Add the report to a GitHub Actions job summary:\n<%= config.bin %> <%= command.id %> --target-org prod --output-format markdown >> \"$GITHUB_STEP_SUMMARY\""
136
159
  ],
137
160
  "flags": {
138
161
  "json": {
@@ -196,6 +219,19 @@
196
219
  "summary": "Exit with code 1 when the org is below the threshold.",
197
220
  "allowNo": false,
198
221
  "type": "boolean"
222
+ },
223
+ "output-format": {
224
+ "description": "\"human\" prints tables and warnings to the terminal. \"markdown\" prints the report as one Markdown document, warnings included, for a pull request comment or a GitHub Actions job summary. Redirect it to a file, for example `>> \"$GITHUB_STEP_SUMMARY\"`. --json takes precedence over both.",
225
+ "name": "output-format",
226
+ "summary": "Format of the report printed to standard output.",
227
+ "default": "human",
228
+ "hasDynamicHelp": false,
229
+ "multiple": false,
230
+ "options": [
231
+ "human",
232
+ "markdown"
233
+ ],
234
+ "type": "option"
199
235
  }
200
236
  },
201
237
  "hasDynamicHelp": true,
@@ -223,7 +259,7 @@
223
259
  "flowcov:scaffold": {
224
260
  "aliases": [],
225
261
  "args": {},
226
- "description": "Reads each Flow's metadata file from the project and writes an Apex test class named `<Flow>_FlowTest` that runs it: record-triggered Flows get a record built from the trigger object and entry criteria, autolaunched Flows are started with Flow.Interview and their input variables, and platform event Flows publish the event. When a target org is available (--target-org or a default org), the command describes each object the test creates and fills in its required fields, the fields the entry criteria need, and parent records (and their parents) for required lookups.\n\nEntry criteria are read as one condition, whether they are filters (with AND, OR, or custom logic) or a formula. The command meets one branch of an OR, and handles comparisons with literals, other fields, `$User.Id`, and `TODAY()`; `$Record__Prior` values in update tests; and fields on related records, which it sets on the parent record it inserts.\n\nFor record-triggered Flows, the command follows the Flow's elements for the record the test creates, deciding each decision the record settles (including formula resources, and lookups on data the test doesn't create, which find nothing in an Apex test). It asserts the fields the Flow is certain to set and the records it is certain to create. When the Flow is certain to stop the save with a custom error, the test expects that error, and a second test sets the fields that avoid it. For autolaunched Flows, it asserts output variables the Flow is certain to set. What the Flow does only on a decision outcome the command can't predict gets commented-out assertions. The generated tests have TODOs for anything the command can't fill in.\n\nOnly Apex tests count toward deploying Flows as active, so this command generates Apex, not Flow Builder tests.",
262
+ "description": "Reads each Flow's metadata file from the project and writes an Apex test class named `<Flow>_FlowTest` that runs it: record-triggered Flows get a record built from the trigger object and entry criteria, autolaunched Flows are started with Flow.Interview and their input variables, and platform event Flows publish the event. When a target org is available (--target-org or a default org), the command describes each object the test creates and fills in its required fields, the fields the entry criteria need, and parent records (and their parents) for required lookups. It also reads each object's active validation rules: a record the test saves (the triggering record on insert and on update, parents, and input records) gets the field values that keep a rule from blocking it, and a rule it can't avoid gets a TODO that names it. Required lookup filters (on standard and custom lookups) are met the same way: a parent record the test inserts gets the field values the filter needs.\n\nEntry criteria are read as one condition, whether they are filters (with AND, OR, or custom logic) or a formula. The command meets one branch of an OR, and handles comparisons with literals, other fields, `$User.Id`, and `TODAY()`; `$Record__Prior` values in update tests; and fields on related records, which it sets on the parent record it inserts.\n\nFor record-triggered Flows, the command follows the Flow's elements for the record the test creates, deciding each decision the record settles (including formula resources, and lookups on data the test doesn't create, which find nothing in an Apex test). It asserts the fields the Flow is certain to set and the records it is certain to create. When the Flow is certain to stop the save with a custom error, the test expects that error, and a second test sets the fields that avoid it. For autolaunched Flows, it asserts output variables the Flow is certain to set. What the Flow does only on a decision outcome the command can't predict gets commented-out assertions. The generated tests have TODOs for anything the command can't fill in.\n\nOnly Apex tests count toward deploying Flows as active, so this command generates Apex, not Flow Builder tests.",
227
263
  "examples": [
228
264
  "Generate a test for one Flow:\n<%= config.bin %> <%= command.id %> --flow Account_After_Save",
229
265
  "Generate tests for every active Flow the org has no coverage for:\n<%= config.bin %> <%= command.id %> --uncovered --target-org prod",
@@ -422,5 +458,5 @@
422
458
  ]
423
459
  }
424
460
  },
425
- "version": "0.4.1"
461
+ "version": "0.5.0"
426
462
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sf-flow-coverage",
3
3
  "description": "Get your Salesforce org ready to deploy Flows as active: find uncovered Flows, gate coverage per Flow in pull requests, and scaffold Apex tests.",
4
- "version": "0.4.1",
4
+ "version": "0.5.0",
5
5
  "dependencies": {
6
6
  "@oclif/core": "5.1.12",
7
7
  "@salesforce/core": "9.4.6",