sf-flow-coverage 0.0.0-stage → 0.0.1

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 (55) hide show
  1. package/LICENSE.md +9 -0
  2. package/README.md +275 -2
  3. package/lib/commands/flowcov/gate.d.ts +17 -0
  4. package/lib/commands/flowcov/gate.js +82 -0
  5. package/lib/commands/flowcov/gate.js.map +1 -0
  6. package/lib/commands/flowcov/readiness.d.ts +17 -0
  7. package/lib/commands/flowcov/readiness.js +87 -0
  8. package/lib/commands/flowcov/readiness.js.map +1 -0
  9. package/lib/commands/flowcov/scaffold.d.ts +18 -0
  10. package/lib/commands/flowcov/scaffold.js +76 -0
  11. package/lib/commands/flowcov/scaffold.js.map +1 -0
  12. package/lib/core/apexTemplate.d.ts +18 -0
  13. package/lib/core/apexTemplate.js +310 -0
  14. package/lib/core/apexTemplate.js.map +1 -0
  15. package/lib/core/flowTypes.d.ts +16 -0
  16. package/lib/core/flowTypes.js +29 -0
  17. package/lib/core/flowTypes.js.map +1 -0
  18. package/lib/core/flowXml.d.ts +8 -0
  19. package/lib/core/flowXml.js +97 -0
  20. package/lib/core/flowXml.js.map +1 -0
  21. package/lib/core/gate.d.ts +20 -0
  22. package/lib/core/gate.js +92 -0
  23. package/lib/core/gate.js.map +1 -0
  24. package/lib/core/git.d.ts +13 -0
  25. package/lib/core/git.js +81 -0
  26. package/lib/core/git.js.map +1 -0
  27. package/lib/core/orgCoverageSource.d.ts +17 -0
  28. package/lib/core/orgCoverageSource.js +108 -0
  29. package/lib/core/orgCoverageSource.js.map +1 -0
  30. package/lib/core/projectFiles.d.ts +9 -0
  31. package/lib/core/projectFiles.js +48 -0
  32. package/lib/core/projectFiles.js.map +1 -0
  33. package/lib/core/readiness.d.ts +12 -0
  34. package/lib/core/readiness.js +37 -0
  35. package/lib/core/readiness.js.map +1 -0
  36. package/lib/core/requiredFields.d.ts +27 -0
  37. package/lib/core/requiredFields.js +75 -0
  38. package/lib/core/requiredFields.js.map +1 -0
  39. package/lib/core/scaffold.d.ts +18 -0
  40. package/lib/core/scaffold.js +79 -0
  41. package/lib/core/scaffold.js.map +1 -0
  42. package/lib/core/toolingQuery.d.ts +7 -0
  43. package/lib/core/toolingQuery.js +16 -0
  44. package/lib/core/toolingQuery.js.map +1 -0
  45. package/lib/core/types.d.ts +117 -0
  46. package/lib/core/types.js +2 -0
  47. package/lib/core/types.js.map +1 -0
  48. package/lib/index.d.ts +14 -0
  49. package/lib/index.js +10 -0
  50. package/lib/index.js.map +1 -0
  51. package/messages/flowcov.gate.md +49 -0
  52. package/messages/flowcov.readiness.md +39 -0
  53. package/messages/flowcov.scaffold.md +59 -0
  54. package/oclif.manifest.json +317 -0
  55. package/package.json +311 -3
@@ -0,0 +1,117 @@
1
+ /** One Apex test method that ran a Flow version. */
2
+ export type FlowTestRef = {
3
+ className: string;
4
+ methodName: string;
5
+ };
6
+ /** Coverage of a single Flow version, as reported by the coverage source. */
7
+ export type FlowCoverage = {
8
+ /** Flow API name, prefixed with `namespace__` for managed Flows. */
9
+ flowName: string;
10
+ flowVersionId: string;
11
+ versionNumber?: number;
12
+ processType: string;
13
+ status?: string;
14
+ /** True when at least one Apex test ran this Flow version. */
15
+ covered: boolean;
16
+ elementsCovered: number;
17
+ elementsTotal: number;
18
+ /** Elements covered across all tests, 0-100. */
19
+ elementCoveragePercent: number;
20
+ tests: FlowTestRef[];
21
+ };
22
+ /**
23
+ * Where Flow coverage comes from. Today the only implementation reads FlowTestCoverage
24
+ * through the Tooling API; this seam exists so Flow Builder Test Mode coverage can be
25
+ * added if Salesforce exposes it or starts counting it toward deploy-as-active.
26
+ */
27
+ export type CoverageSource = {
28
+ /** Every active Flow version that counts toward the deploy-as-active coverage requirement. */
29
+ listActiveCountedFlows(): Promise<FlowCoverage[]>;
30
+ /** Coverage for the named Flows (active version, else latest). Names missing from the org are omitted. */
31
+ getFlowCoverage(flowNames: string[]): Promise<FlowCoverage[]>;
32
+ };
33
+ /** Runs a Tooling API SOQL query and returns every record (all pages). */
34
+ export type ToolingQuery = <T extends Record<string, unknown>>(soql: string) => Promise<T[]>;
35
+ export type FlowFilter = {
36
+ field: string;
37
+ operator: string;
38
+ /** Apex literal for the filter value, when it can be expressed as one. */
39
+ apexValue?: string;
40
+ /** Raw value text, for TODO comments. */
41
+ rawValue?: string;
42
+ };
43
+ export type FlowVariable = {
44
+ name: string;
45
+ dataType: string;
46
+ isInput: boolean;
47
+ isOutput: boolean;
48
+ isCollection: boolean;
49
+ objectType?: string;
50
+ apexClass?: string;
51
+ };
52
+ /** The parts of a Flow's metadata XML the tool needs. */
53
+ export type FlowMetadata = {
54
+ name: string;
55
+ label?: string;
56
+ processType?: string;
57
+ status?: string;
58
+ /** start.triggerType: RecordAfterSave, RecordBeforeSave, RecordBeforeDelete, PlatformEvent, Scheduled. */
59
+ triggerType?: string;
60
+ /** start.recordTriggerType: Create, Update, CreateAndUpdate, Delete. */
61
+ recordTriggerType?: string;
62
+ /** start.object: the triggering sObject or platform event. */
63
+ object?: string;
64
+ filters: FlowFilter[];
65
+ filterLogic?: string;
66
+ filterFormula?: string;
67
+ variables: FlowVariable[];
68
+ };
69
+ export type ReadinessFlow = {
70
+ flowName: string;
71
+ processType: string;
72
+ versionNumber?: number;
73
+ covered: boolean;
74
+ elementCoveragePercent: number;
75
+ tests: FlowTestRef[];
76
+ /** Commits that touched the Flow's source file, when the project is a git repo. */
77
+ changes?: number;
78
+ };
79
+ export type ReadinessResult = {
80
+ threshold: number;
81
+ totalFlows: number;
82
+ coveredFlows: number;
83
+ uncoveredFlows: number;
84
+ coveragePercent: number;
85
+ ready: boolean;
86
+ /** Additional Flows that need a test to reach the threshold. */
87
+ flowsNeeded: number;
88
+ /** Uncovered first (most-changed first), then covered. */
89
+ flows: ReadinessFlow[];
90
+ };
91
+ export type GateStatus = 'pass' | 'fail' | 'skip';
92
+ export type GateFlowResult = {
93
+ flowName: string;
94
+ status: GateStatus;
95
+ reason: string;
96
+ path?: string;
97
+ versionNumber?: number;
98
+ elementCoveragePercent?: number;
99
+ tests: FlowTestRef[];
100
+ };
101
+ export type GateResult = {
102
+ passed: boolean;
103
+ minElementCoverage: number;
104
+ flows: GateFlowResult[];
105
+ };
106
+ export type ScaffoldedTest = {
107
+ flowName: string;
108
+ className: string;
109
+ path: string;
110
+ };
111
+ export type ScaffoldResult = {
112
+ created: ScaffoldedTest[];
113
+ skipped: Array<{
114
+ flowName: string;
115
+ reason: string;
116
+ }>;
117
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":""}
package/lib/index.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ export { apexClassMetaXml, apexTestClassName, generateApexTest } from './core/apexTemplate.js';
2
+ export { COUNTED_PROCESS_TYPES, DEFAULT_THRESHOLD, isCountedProcessType } from './core/flowTypes.js';
3
+ export { parseFlowXml } from './core/flowXml.js';
4
+ export type { GateCandidate, GateOptions } from './core/gate.js';
5
+ export { collectChangedFlows, evaluateGate } from './core/gate.js';
6
+ export { OrgCoverageSource } from './core/orgCoverageSource.js';
7
+ export type { ReadinessOptions } from './core/readiness.js';
8
+ export { buildReadinessReport } from './core/readiness.js';
9
+ export type { DescribeField, DescribeObject, RequiredFieldMap } from './core/requiredFields.js';
10
+ export { requiredFieldValues } from './core/requiredFields.js';
11
+ export type { ScaffoldOptions } from './core/scaffold.js';
12
+ export { scaffoldTests } from './core/scaffold.js';
13
+ export { describeObject, toolingQuery } from './core/toolingQuery.js';
14
+ export type * from './core/types.js';
package/lib/index.js ADDED
@@ -0,0 +1,10 @@
1
+ export { apexClassMetaXml, apexTestClassName, generateApexTest } from './core/apexTemplate.js';
2
+ export { COUNTED_PROCESS_TYPES, DEFAULT_THRESHOLD, isCountedProcessType } from './core/flowTypes.js';
3
+ export { parseFlowXml } from './core/flowXml.js';
4
+ export { collectChangedFlows, evaluateGate } from './core/gate.js';
5
+ export { OrgCoverageSource } from './core/orgCoverageSource.js';
6
+ export { buildReadinessReport } from './core/readiness.js';
7
+ export { requiredFieldValues } from './core/requiredFields.js';
8
+ export { scaffoldTests } from './core/scaffold.js';
9
+ export { describeObject, toolingQuery } from './core/toolingQuery.js';
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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;AAC/F,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,cAAc,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,49 @@
1
+ # summary
2
+
3
+ Require Apex test coverage for every Flow a pull request changes.
4
+
5
+ # description
6
+
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
+
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.
10
+
11
+ Exits with code 1 when any Flow fails.
12
+
13
+ # examples
14
+
15
+ - Check the Flows changed in a pull request:
16
+
17
+ <%= config.bin %> <%= command.id %> --target-org ci-sandbox --from origin/main --to HEAD
18
+
19
+ - Also require 60% element coverage per Flow:
20
+
21
+ <%= config.bin %> <%= command.id %> --target-org ci-sandbox --from origin/main --min-element-coverage 60
22
+
23
+ - Check named Flows without git:
24
+
25
+ <%= config.bin %> <%= command.id %> --target-org ci-sandbox --flow Account_After_Save --flow Close_Cases
26
+
27
+ # flags.from.summary
28
+
29
+ Git ref the pull request merges into (the gate compares from the merge base of this ref).
30
+
31
+ # flags.to.summary
32
+
33
+ Git ref with the changes.
34
+
35
+ # flags.flow.summary
36
+
37
+ Flow API name to check. Use instead of --from to skip git.
38
+
39
+ # flags.project-dir.summary
40
+
41
+ Git repository to read changed Flows from.
42
+
43
+ # flags.min-element-coverage.summary
44
+
45
+ Minimum percentage of each Flow's elements that tests must run.
46
+
47
+ # error.noInput
48
+
49
+ Provide --from to check changed Flows, or --flow to check named Flows.
@@ -0,0 +1,39 @@
1
+ # summary
2
+
3
+ Report how close the org is to the coverage needed to deploy Flows as active.
4
+
5
+ # description
6
+
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
+
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.
10
+
11
+ # examples
12
+
13
+ - Report readiness for the default org:
14
+
15
+ <%= config.bin %> <%= command.id %>
16
+
17
+ - Rank uncovered Flows by changes in the last 6 months:
18
+
19
+ <%= config.bin %> <%= command.id %> --target-org prod --since "6 months ago"
20
+
21
+ - Fail a CI job unless the org is at or above 75%:
22
+
23
+ <%= config.bin %> <%= command.id %> --target-org prod --fail-if-not-ready
24
+
25
+ # flags.project-dir.summary
26
+
27
+ Git repository used to rank uncovered Flows by how often they change.
28
+
29
+ # flags.since.summary
30
+
31
+ Only count commits after this date (any value `git log --since` accepts).
32
+
33
+ # flags.threshold.summary
34
+
35
+ Coverage percentage the org must reach.
36
+
37
+ # flags.fail-if-not-ready.summary
38
+
39
+ Exit with code 1 when the org is below the threshold.
@@ -0,0 +1,59 @@
1
+ # summary
2
+
3
+ Generate starter Apex tests for Flows.
4
+
5
+ # description
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.
8
+
9
+ Only Apex tests count toward deploying Flows as active, so this command generates Apex, not Flow Builder tests.
10
+
11
+ # examples
12
+
13
+ - Generate a test for one Flow:
14
+
15
+ <%= config.bin %> <%= command.id %> --flow Account_After_Save
16
+
17
+ - Generate tests for every active Flow the org has no coverage for:
18
+
19
+ <%= config.bin %> <%= command.id %> --uncovered --target-org prod
20
+
21
+ - Preview without writing files:
22
+
23
+ <%= config.bin %> <%= command.id %> --flow Account_After_Save --dry-run
24
+
25
+ # flags.target-org.summary
26
+
27
+ Org used to find uncovered Flows (--uncovered) and to describe objects so generated records set their required fields.
28
+
29
+ # flags.flow.summary
30
+
31
+ Flow API name to generate a test for.
32
+
33
+ # flags.uncovered.summary
34
+
35
+ Generate tests for every active Flow in the target org that no Apex test runs.
36
+
37
+ # flags.project-dir.summary
38
+
39
+ Salesforce DX project to read Flow metadata from.
40
+
41
+ # flags.output-dir.summary
42
+
43
+ Directory to write test classes to. Defaults to the default package directory's main/default/classes.
44
+
45
+ # flags.force.summary
46
+
47
+ Overwrite test classes that already exist.
48
+
49
+ # flags.dry-run.summary
50
+
51
+ Show what would be generated without writing files.
52
+
53
+ # error.noInput
54
+
55
+ Provide --flow or --uncovered.
56
+
57
+ # error.uncoveredNeedsOrg
58
+
59
+ --uncovered needs --target-org (or a default org) to find uncovered Flows.
@@ -0,0 +1,317 @@
1
+ {
2
+ "commands": {
3
+ "flowcov:gate": {
4
+ "aliases": [],
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.",
7
+ "examples": [
8
+ "Check the Flows changed in a pull request:\n<%= config.bin %> <%= command.id %> --target-org ci-sandbox --from origin/main --to HEAD",
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
+ "Check named Flows without git:\n<%= config.bin %> <%= command.id %> --target-org ci-sandbox --flow Account_After_Save --flow Close_Cases"
11
+ ],
12
+ "flags": {
13
+ "json": {
14
+ "description": "Format output as json.",
15
+ "helpGroup": "GLOBAL",
16
+ "name": "json",
17
+ "allowNo": false,
18
+ "type": "boolean"
19
+ },
20
+ "flags-dir": {
21
+ "helpGroup": "GLOBAL",
22
+ "name": "flags-dir",
23
+ "summary": "Import flag values from a directory.",
24
+ "hasDynamicHelp": false,
25
+ "multiple": false,
26
+ "type": "option"
27
+ },
28
+ "target-org": {
29
+ "char": "o",
30
+ "name": "target-org",
31
+ "noCacheDefault": true,
32
+ "required": true,
33
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
34
+ "hasDynamicHelp": true,
35
+ "multiple": false,
36
+ "type": "option"
37
+ },
38
+ "api-version": {
39
+ "description": "Override the api version used for api requests made by this command",
40
+ "name": "api-version",
41
+ "hasDynamicHelp": false,
42
+ "multiple": false,
43
+ "type": "option"
44
+ },
45
+ "from": {
46
+ "exclusive": [
47
+ "flow"
48
+ ],
49
+ "name": "from",
50
+ "summary": "Git ref the pull request merges into (the gate compares from the merge base of this ref).",
51
+ "hasDynamicHelp": false,
52
+ "multiple": false,
53
+ "type": "option"
54
+ },
55
+ "to": {
56
+ "name": "to",
57
+ "summary": "Git ref with the changes.",
58
+ "default": "HEAD",
59
+ "hasDynamicHelp": false,
60
+ "multiple": false,
61
+ "type": "option"
62
+ },
63
+ "flow": {
64
+ "exclusive": [
65
+ "from"
66
+ ],
67
+ "name": "flow",
68
+ "summary": "Flow API name to check. Use instead of --from to skip git.",
69
+ "hasDynamicHelp": false,
70
+ "multiple": true,
71
+ "type": "option"
72
+ },
73
+ "project-dir": {
74
+ "char": "d",
75
+ "name": "project-dir",
76
+ "summary": "Git repository to read changed Flows from.",
77
+ "default": ".",
78
+ "hasDynamicHelp": false,
79
+ "multiple": false,
80
+ "type": "option"
81
+ },
82
+ "min-element-coverage": {
83
+ "name": "min-element-coverage",
84
+ "summary": "Minimum percentage of each Flow's elements that tests must run.",
85
+ "default": 0,
86
+ "hasDynamicHelp": false,
87
+ "multiple": false,
88
+ "type": "option"
89
+ }
90
+ },
91
+ "hasDynamicHelp": true,
92
+ "hiddenAliases": [],
93
+ "id": "flowcov:gate",
94
+ "pluginAlias": "sf-flow-coverage",
95
+ "pluginName": "sf-flow-coverage",
96
+ "pluginType": "core",
97
+ "strict": true,
98
+ "summary": "Require Apex test coverage for every Flow a pull request changes.",
99
+ "enableJsonFlag": true,
100
+ "isESM": true,
101
+ "relativePath": [
102
+ "lib",
103
+ "commands",
104
+ "flowcov",
105
+ "gate.js"
106
+ ],
107
+ "aliasPermutations": [],
108
+ "permutations": [
109
+ "flowcov:gate",
110
+ "gate:flowcov"
111
+ ]
112
+ },
113
+ "flowcov:readiness": {
114
+ "aliases": [],
115
+ "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.",
117
+ "examples": [
118
+ "Report readiness for the default org:\n<%= config.bin %> <%= command.id %>",
119
+ "Rank uncovered Flows by changes in the last 6 months:\n<%= config.bin %> <%= command.id %> --target-org prod --since \"6 months ago\"",
120
+ "Fail a CI job unless the org is at or above 75%:\n<%= config.bin %> <%= command.id %> --target-org prod --fail-if-not-ready"
121
+ ],
122
+ "flags": {
123
+ "json": {
124
+ "description": "Format output as json.",
125
+ "helpGroup": "GLOBAL",
126
+ "name": "json",
127
+ "allowNo": false,
128
+ "type": "boolean"
129
+ },
130
+ "flags-dir": {
131
+ "helpGroup": "GLOBAL",
132
+ "name": "flags-dir",
133
+ "summary": "Import flag values from a directory.",
134
+ "hasDynamicHelp": false,
135
+ "multiple": false,
136
+ "type": "option"
137
+ },
138
+ "target-org": {
139
+ "char": "o",
140
+ "name": "target-org",
141
+ "noCacheDefault": true,
142
+ "required": true,
143
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
144
+ "hasDynamicHelp": true,
145
+ "multiple": false,
146
+ "type": "option"
147
+ },
148
+ "api-version": {
149
+ "description": "Override the api version used for api requests made by this command",
150
+ "name": "api-version",
151
+ "hasDynamicHelp": false,
152
+ "multiple": false,
153
+ "type": "option"
154
+ },
155
+ "project-dir": {
156
+ "char": "d",
157
+ "name": "project-dir",
158
+ "summary": "Git repository used to rank uncovered Flows by how often they change.",
159
+ "default": ".",
160
+ "hasDynamicHelp": false,
161
+ "multiple": false,
162
+ "type": "option"
163
+ },
164
+ "since": {
165
+ "name": "since",
166
+ "summary": "Only count commits after this date (any value `git log --since` accepts).",
167
+ "hasDynamicHelp": false,
168
+ "multiple": false,
169
+ "type": "option"
170
+ },
171
+ "threshold": {
172
+ "name": "threshold",
173
+ "summary": "Coverage percentage the org must reach.",
174
+ "default": 75,
175
+ "hasDynamicHelp": false,
176
+ "multiple": false,
177
+ "type": "option"
178
+ },
179
+ "fail-if-not-ready": {
180
+ "name": "fail-if-not-ready",
181
+ "summary": "Exit with code 1 when the org is below the threshold.",
182
+ "allowNo": false,
183
+ "type": "boolean"
184
+ }
185
+ },
186
+ "hasDynamicHelp": true,
187
+ "hiddenAliases": [],
188
+ "id": "flowcov:readiness",
189
+ "pluginAlias": "sf-flow-coverage",
190
+ "pluginName": "sf-flow-coverage",
191
+ "pluginType": "core",
192
+ "strict": true,
193
+ "summary": "Report how close the org is to the coverage needed to deploy Flows as active.",
194
+ "enableJsonFlag": true,
195
+ "isESM": true,
196
+ "relativePath": [
197
+ "lib",
198
+ "commands",
199
+ "flowcov",
200
+ "readiness.js"
201
+ ],
202
+ "aliasPermutations": [],
203
+ "permutations": [
204
+ "flowcov:readiness",
205
+ "readiness:flowcov"
206
+ ]
207
+ },
208
+ "flowcov:scaffold": {
209
+ "aliases": [],
210
+ "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.",
212
+ "examples": [
213
+ "Generate a test for one Flow:\n<%= config.bin %> <%= command.id %> --flow Account_After_Save",
214
+ "Generate tests for every active Flow the org has no coverage for:\n<%= config.bin %> <%= command.id %> --uncovered --target-org prod",
215
+ "Preview without writing files:\n<%= config.bin %> <%= command.id %> --flow Account_After_Save --dry-run"
216
+ ],
217
+ "flags": {
218
+ "json": {
219
+ "description": "Format output as json.",
220
+ "helpGroup": "GLOBAL",
221
+ "name": "json",
222
+ "allowNo": false,
223
+ "type": "boolean"
224
+ },
225
+ "flags-dir": {
226
+ "helpGroup": "GLOBAL",
227
+ "name": "flags-dir",
228
+ "summary": "Import flag values from a directory.",
229
+ "hasDynamicHelp": false,
230
+ "multiple": false,
231
+ "type": "option"
232
+ },
233
+ "flow": {
234
+ "char": "f",
235
+ "name": "flow",
236
+ "summary": "Flow API name to generate a test for.",
237
+ "hasDynamicHelp": false,
238
+ "multiple": true,
239
+ "type": "option"
240
+ },
241
+ "uncovered": {
242
+ "name": "uncovered",
243
+ "summary": "Generate tests for every active Flow in the target org that no Apex test runs.",
244
+ "allowNo": false,
245
+ "type": "boolean"
246
+ },
247
+ "target-org": {
248
+ "char": "o",
249
+ "name": "target-org",
250
+ "noCacheDefault": true,
251
+ "summary": "Org used to find uncovered Flows (--uncovered) and to describe objects so generated records set their required fields.",
252
+ "hasDynamicHelp": true,
253
+ "multiple": false,
254
+ "type": "option"
255
+ },
256
+ "api-version": {
257
+ "description": "Override the api version used for api requests made by this command",
258
+ "name": "api-version",
259
+ "hasDynamicHelp": false,
260
+ "multiple": false,
261
+ "type": "option"
262
+ },
263
+ "project-dir": {
264
+ "char": "d",
265
+ "name": "project-dir",
266
+ "summary": "Salesforce DX project to read Flow metadata from.",
267
+ "default": ".",
268
+ "hasDynamicHelp": false,
269
+ "multiple": false,
270
+ "type": "option"
271
+ },
272
+ "output-dir": {
273
+ "char": "r",
274
+ "name": "output-dir",
275
+ "summary": "Directory to write test classes to. Defaults to the default package directory's main/default/classes.",
276
+ "hasDynamicHelp": false,
277
+ "multiple": false,
278
+ "type": "option"
279
+ },
280
+ "force": {
281
+ "name": "force",
282
+ "summary": "Overwrite test classes that already exist.",
283
+ "allowNo": false,
284
+ "type": "boolean"
285
+ },
286
+ "dry-run": {
287
+ "name": "dry-run",
288
+ "summary": "Show what would be generated without writing files.",
289
+ "allowNo": false,
290
+ "type": "boolean"
291
+ }
292
+ },
293
+ "hasDynamicHelp": true,
294
+ "hiddenAliases": [],
295
+ "id": "flowcov:scaffold",
296
+ "pluginAlias": "sf-flow-coverage",
297
+ "pluginName": "sf-flow-coverage",
298
+ "pluginType": "core",
299
+ "strict": true,
300
+ "summary": "Generate starter Apex tests for Flows.",
301
+ "enableJsonFlag": true,
302
+ "isESM": true,
303
+ "relativePath": [
304
+ "lib",
305
+ "commands",
306
+ "flowcov",
307
+ "scaffold.js"
308
+ ],
309
+ "aliasPermutations": [],
310
+ "permutations": [
311
+ "flowcov:scaffold",
312
+ "scaffold:flowcov"
313
+ ]
314
+ }
315
+ },
316
+ "version": "0.0.1"
317
+ }