sf-flow-coverage 0.1.0 → 0.3.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 (43) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +52 -13
  3. package/lib/commands/flowcov/gate.d.ts +1 -0
  4. package/lib/commands/flowcov/gate.js +12 -1
  5. package/lib/commands/flowcov/gate.js.map +1 -1
  6. package/lib/core/apexTemplate.d.ts +10 -2
  7. package/lib/core/apexTemplate.js +327 -54
  8. package/lib/core/apexTemplate.js.map +1 -1
  9. package/lib/core/filterFormula.d.ts +10 -0
  10. package/lib/core/filterFormula.js +153 -0
  11. package/lib/core/filterFormula.js.map +1 -0
  12. package/lib/core/flowFingerprint.d.ts +27 -0
  13. package/lib/core/flowFingerprint.js +128 -0
  14. package/lib/core/flowFingerprint.js.map +1 -0
  15. package/lib/core/flowGraph.d.ts +94 -0
  16. package/lib/core/flowGraph.js +288 -0
  17. package/lib/core/flowGraph.js.map +1 -0
  18. package/lib/core/flowValues.d.ts +14 -0
  19. package/lib/core/flowValues.js +43 -0
  20. package/lib/core/flowValues.js.map +1 -0
  21. package/lib/core/flowXml.d.ts +1 -1
  22. package/lib/core/flowXml.js +6 -39
  23. package/lib/core/flowXml.js.map +1 -1
  24. package/lib/core/gate.d.ts +12 -1
  25. package/lib/core/gate.js +60 -6
  26. package/lib/core/gate.js.map +1 -1
  27. package/lib/core/git.d.ts +7 -2
  28. package/lib/core/git.js +104 -58
  29. package/lib/core/git.js.map +1 -1
  30. package/lib/core/orgCoverageSource.d.ts +6 -0
  31. package/lib/core/orgCoverageSource.js +43 -8
  32. package/lib/core/orgCoverageSource.js.map +1 -1
  33. package/lib/core/requiredFields.d.ts +39 -2
  34. package/lib/core/requiredFields.js +131 -6
  35. package/lib/core/requiredFields.js.map +1 -1
  36. package/lib/core/scaffold.js +32 -5
  37. package/lib/core/scaffold.js.map +1 -1
  38. package/lib/core/types.d.ts +29 -1
  39. package/messages/flowcov.gate.md +17 -1
  40. package/messages/flowcov.readiness.md +2 -2
  41. package/messages/flowcov.scaffold.md +3 -1
  42. package/oclif.manifest.json +20 -5
  43. package/package.json +10 -9
@@ -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,WAAW,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAuB,kBAAkB,EAAyB,MAAM,qBAAqB,CAAC;AAGrG,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAgB/C,oDAAoD;AACpD,SAAS,eAAe,CAAC,IAAkB;IACzC,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS;SAC3B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,QAAQ,KAAK,SAAS,IAAI,CAAC,CAAC,UAAU,CAAC;SACvF,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAoB,CAAC,CAAC;IACtC,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,eAAe,CAAC,IAAI,IAAI,CAAC,MAAM;QAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,C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raph } from './flowGraph.js';
1
3
  /** One Apex test method that ran a Flow version. */
2
4
  export type FlowTestRef = {
3
5
  className: string;
@@ -18,7 +20,17 @@ export type FlowCoverage = {
18
20
  /** Elements covered across all tests, 0-100. */
19
21
  elementCoveragePercent: number;
20
22
  tests: FlowTestRef[];
23
+ /**
24
+ * How this version relates to the Flow's other versions, when known (set by `getFlowCoverage`):
25
+ * - `current`: it is the active version and the latest one.
26
+ * - `noActiveVersion`: no version is active; this is the latest, inactive version.
27
+ * - `newerInactiveVersion`: it is active, but a newer inactive version exists.
28
+ */
29
+ versionState?: FlowVersionState;
30
+ /** Version number of the Flow's latest version, when it differs from `versionNumber`. */
31
+ latestVersionNumber?: number;
21
32
  };
33
+ export type FlowVersionState = 'current' | 'noActiveVersion' | 'newerInactiveVersion';
22
34
  /**
23
35
  * Where Flow coverage comes from. Today the only implementation reads FlowTestCoverage
24
36
  * through the Tooling API; this seam exists so Flow Builder Test Mode coverage can be
@@ -27,8 +39,16 @@ export type FlowCoverage = {
27
39
  export type CoverageSource = {
28
40
  /** Every active Flow version that counts toward the deploy-as-active coverage requirement. */
29
41
  listActiveCountedFlows(): Promise<FlowCoverage[]>;
30
- /** Coverage for the named Flows (active version, else latest). Names missing from the org are omitted. */
42
+ /**
43
+ * Coverage for the named Flows (active version, else latest), with `versionState` set.
44
+ * Names missing from the org are omitted.
45
+ */
31
46
  getFlowCoverage(flowNames: string[]): Promise<FlowCoverage[]>;
47
+ /**
48
+ * Fingerprint of a Flow version's content, to compare with source. Undefined when the
49
+ * source can't read the version's content.
50
+ */
51
+ getFlowFingerprint?(flowVersionId: string): Promise<FlowFingerprint | undefined>;
32
52
  };
33
53
  /** Runs a Tooling API SOQL query and returns every record (all pages). */
34
54
  export type ToolingQuery = <T extends Record<string, unknown>>(soql: string) => Promise<T[]>;
@@ -39,6 +59,8 @@ export type FlowFilter = {
39
59
  apexValue?: string;
40
60
  /** Raw value text, for TODO comments. */
41
61
  rawValue?: string;
62
+ /** The entry-criteria formula term this filter was read from, for TODO comments. */
63
+ formulaTerm?: string;
42
64
  };
43
65
  export type FlowVariable = {
44
66
  name: string;
@@ -64,6 +86,8 @@ export type FlowMetadata = {
64
86
  filters: FlowFilter[];
65
87
  filterLogic?: string;
66
88
  filterFormula?: string;
89
+ /** The Flow's elements, for working out what a test can assert. */
90
+ graph?: FlowGraph;
67
91
  variables: FlowVariable[];
68
92
  };
69
93
  export type ReadinessFlow = {
@@ -97,7 +121,11 @@ export type GateFlowResult = {
97
121
  versionNumber?: number;
98
122
  elementCoveragePercent?: number;
99
123
  tests: FlowTestRef[];
124
+ /** Problems that don't change `status`, such as an org version that differs from source. */
125
+ warnings?: string[];
100
126
  };
127
+ /** What the gate does when the org's Flow content differs from source. */
128
+ export type ContentCheck = 'warn' | 'fail' | 'off';
101
129
  export type GateResult = {
102
130
  passed: boolean;
103
131
  minElementCoverage: number;
@@ -6,7 +6,11 @@ Require Apex test coverage for every Flow a pull request changes.
6
6
 
7
7
  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.
8
8
 
9
- Coverage is read from FlowTestCoverage in the target org. Deploy the branch to the target org and run Apex tests there before running the gate. Flows that don't count toward deploy-as-active (screen Flows, inactive Flows) are skipped.
9
+ Coverage 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. Flows that don't count toward deploy-as-active (screen Flows, inactive Flows) are skipped.
10
+
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
+
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.
10
14
 
11
15
  Exits with code 1 when any Flow fails.
12
16
 
@@ -20,6 +24,10 @@ Exits with code 1 when any Flow fails.
20
24
 
21
25
  <%= config.bin %> <%= command.id %> --target-org ci-sandbox --from origin/main --min-element-coverage 60
22
26
 
27
+ - Fail when the org runs a different version of a changed Flow than the branch:
28
+
29
+ <%= config.bin %> <%= command.id %> --target-org ci-sandbox --from origin/main --content-check fail
30
+
23
31
  - Check named Flows without git:
24
32
 
25
33
  <%= config.bin %> <%= command.id %> --target-org ci-sandbox --flow Account_After_Save --flow Close_Cases
@@ -44,6 +52,14 @@ Git repository to read changed Flows from.
44
52
 
45
53
  Minimum percentage of each Flow's elements that tests must run.
46
54
 
55
+ # flags.content-check.summary
56
+
57
+ What to do when a changed Flow's content differs from the org's version.
58
+
59
+ # flags.content-check.description
60
+
61
+ "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.
62
+
47
63
  # error.noInput
48
64
 
49
65
  Provide --from to check changed Flows, or --flow to check named Flows.
@@ -6,7 +6,7 @@ Report how close the org is to the coverage needed to deploy Flows as active.
6
6
 
7
7
  Salesforce requires 75% of active autolaunched Flows and processes to be run by at least one Apex test before you can turn on "Deploy processes and flows as active". This command reads FlowTestCoverage from the target org, reports the org-wide percentage against the threshold, and lists the uncovered Flows (ranked by how often they change in git) and the Apex tests that already run each covered Flow.
8
8
 
9
- FlowTestCoverage is filled in when Apex tests run in the org. Run your Apex tests first (for example, `sf apex run test --test-level RunLocalTests --wait 60`) so the report is current.
9
+ FlowTestCoverage is filled in when Apex tests run in the org. Run your Apex tests first with coverage turned on (for example, `sf apex run test --test-level RunLocalTests --code-coverage --wait 60`) so the report is current. Without `--code-coverage`, Salesforce records no Flow coverage.
10
10
 
11
11
  # examples
12
12
 
@@ -28,7 +28,7 @@ Git repository used to rank uncovered Flows by how often they change.
28
28
 
29
29
  # flags.since.summary
30
30
 
31
- Only count commits after this date (any value `git log --since` accepts).
31
+ Only count commits after this date: a date (2026-01-31) or "<n> days|weeks|months|years ago".
32
32
 
33
33
  # flags.threshold.summary
34
34
 
@@ -4,7 +4,9 @@ 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 generated tests have TODOs for anything it can't fill in and placeholder assertions.
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 for required lookups.
8
+
9
+ For record-triggered Flows, the command follows the Flow's elements for the record the test creates. It asserts the fields the Flow is certain to set, and when the Flow is certain to stop the save with a custom error, the test expects that error. Fields the Flow sets only on a decision outcome the command can't predict get commented-out assertions. The generated tests have TODOs for anything the command can't fill in.
8
10
 
9
11
  Only Apex tests count toward deploying Flows as active, so this command generates Apex, not Flow Builder tests.
10
12
 
@@ -3,10 +3,11 @@
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 before running the gate. Flows that don't count toward deploy-as-active (screen Flows, inactive Flows) are skipped.\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. 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\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
+ "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",
10
11
  "Check named Flows without git:\n<%= config.bin %> <%= command.id %> --target-org ci-sandbox --flow Account_After_Save --flow Close_Cases"
11
12
  ],
12
13
  "flags": {
@@ -86,6 +87,20 @@
86
87
  "hasDynamicHelp": false,
87
88
  "multiple": false,
88
89
  "type": "option"
90
+ },
91
+ "content-check": {
92
+ "description": "\"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.",
93
+ "name": "content-check",
94
+ "summary": "What to do when a changed Flow's content differs from the org's version.",
95
+ "default": "warn",
96
+ "hasDynamicHelp": false,
97
+ "multiple": false,
98
+ "options": [
99
+ "warn",
100
+ "fail",
101
+ "off"
102
+ ],
103
+ "type": "option"
89
104
  }
90
105
  },
91
106
  "hasDynamicHelp": true,
@@ -113,7 +128,7 @@
113
128
  "flowcov:readiness": {
114
129
  "aliases": [],
115
130
  "args": {},
116
- "description": "Salesforce requires 75% of active autolaunched Flows and processes to be run by at least one Apex test before you can turn on \"Deploy processes and flows as active\". This command reads FlowTestCoverage from the target org, reports the org-wide percentage against the threshold, and lists the uncovered Flows (ranked by how often they change in git) and the Apex tests that already run each covered Flow.\n\nFlowTestCoverage is filled in when Apex tests run in the org. Run your Apex tests first (for example, `sf apex run test --test-level RunLocalTests --wait 60`) so the report is current.",
131
+ "description": "Salesforce requires 75% of active autolaunched Flows and processes to be run by at least one Apex test before you can turn on \"Deploy processes and flows as active\". This command reads FlowTestCoverage from the target org, reports the org-wide percentage against the threshold, and lists the uncovered Flows (ranked by how often they change in git) and the Apex tests that already run each covered Flow.\n\nFlowTestCoverage is filled in when Apex tests run in the org. Run your Apex tests first with coverage turned on (for example, `sf apex run test --test-level RunLocalTests --code-coverage --wait 60`) so the report is current. Without `--code-coverage`, Salesforce records no Flow coverage.",
117
132
  "examples": [
118
133
  "Report readiness for the default org:\n<%= config.bin %> <%= command.id %>",
119
134
  "Rank uncovered Flows by changes in the last 6 months:\n<%= config.bin %> <%= command.id %> --target-org prod --since \"6 months ago\"",
@@ -163,7 +178,7 @@
163
178
  },
164
179
  "since": {
165
180
  "name": "since",
166
- "summary": "Only count commits after this date (any value `git log --since` accepts).",
181
+ "summary": "Only count commits after this date: a date (2026-01-31) or \"<n> days|weeks|months|years ago\".",
167
182
  "hasDynamicHelp": false,
168
183
  "multiple": false,
169
184
  "type": "option"
@@ -208,7 +223,7 @@
208
223
  "flowcov:scaffold": {
209
224
  "aliases": [],
210
225
  "args": {},
211
- "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 generated tests have TODOs for anything it can't fill in and placeholder assertions.\n\nOnly Apex tests count toward deploying Flows as active, so this command generates Apex, not Flow Builder tests.",
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 for required lookups.\n\nFor record-triggered Flows, the command follows the Flow's elements for the record the test creates. It asserts the fields the Flow is certain to set, and when the Flow is certain to stop the save with a custom error, the test expects that error. Fields the Flow sets only on a decision outcome the command can't predict get 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.",
212
227
  "examples": [
213
228
  "Generate a test for one Flow:\n<%= config.bin %> <%= command.id %> --flow Account_After_Save",
214
229
  "Generate tests for every active Flow the org has no coverage for:\n<%= config.bin %> <%= command.id %> --uncovered --target-org prod",
@@ -313,5 +328,5 @@
313
328
  ]
314
329
  }
315
330
  },
316
- "version": "0.1.0"
331
+ "version": "0.3.0"
317
332
  }
package/package.json CHANGED
@@ -1,26 +1,27 @@
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.1.0",
4
+ "version": "0.3.0",
5
5
  "dependencies": {
6
- "@oclif/core": "5.1.11",
7
- "@salesforce/core": "9.4.5",
6
+ "@oclif/core": "5.1.12",
7
+ "@salesforce/core": "9.4.6",
8
8
  "@salesforce/sf-plugins-core": "13.0.9",
9
+ "@scolladon/tsgit": "6.0.0",
9
10
  "fast-xml-parser": "5.12.1"
10
11
  },
11
12
  "devDependencies": {
12
- "@biomejs/biome": "2.6.6",
13
+ "@biomejs/biome": "2.6.8",
13
14
  "@commitlint/cli": "21.2.4",
14
15
  "@commitlint/config-conventional": "21.2.4",
15
- "@salesforce/cli-plugins-testkit": "5.3.93",
16
+ "@salesforce/cli-plugins-testkit": "5.3.95",
16
17
  "@salesforce/dev-config": "4.3.3",
17
18
  "@stryker-mutator/core": "10.1.1",
18
19
  "@stryker-mutator/vitest-runner": "10.1.1",
19
20
  "@types/node": "26.6.6",
20
21
  "@vitest/coverage-v8": "5.1.0",
21
22
  "husky": "9.1.7",
22
- "knip": "6.44.2",
23
- "lint-staged": "17.6.0",
23
+ "knip": "6.45.1",
24
+ "lint-staged": "17.6.1",
24
25
  "ls-engines": "0.10.1",
25
26
  "oclif": "6.0.15",
26
27
  "shx": "0.4.0",
@@ -30,7 +31,7 @@
30
31
  "wireit": "0.15.0"
31
32
  },
32
33
  "engines": {
33
- "node": ">=22.19.0"
34
+ "node": ">=22.22.0"
34
35
  },
35
36
  "files": [
36
37
  "/lib",
@@ -311,4 +312,4 @@
311
312
  "allowScripts": {
312
313
  "esbuild@0.28.2": true
313
314
  }
314
- }
315
+ }