sf-delta-tests 0.0.27 → 0.2.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.
- package/README.md +79 -146
- package/lib/commands/delta/test-classes.d.ts +12 -9
- package/lib/commands/delta/test-classes.js +63 -48
- package/lib/commands/delta/test-classes.js.map +1 -1
- package/lib/elements/object-types.js +23 -26
- package/lib/elements/object-types.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -2
- package/lib/index.js.map +1 -1
- package/lib/services/apex-class-service.js +8 -12
- package/lib/services/apex-class-service.js.map +1 -1
- package/lib/services/cli-service.js +1 -5
- package/lib/services/cli-service.js.map +1 -1
- package/lib/services/dependency-service.js +19 -22
- package/lib/services/dependency-service.js.map +1 -1
- package/lib/services/dependency-services.test.js +6 -8
- package/lib/services/dependency-services.test.js.map +1 -1
- package/lib/services/flow-service.d.ts +41 -0
- package/lib/services/flow-service.js +136 -0
- package/lib/services/flow-service.js.map +1 -0
- package/lib/services/manifest-service.d.ts +6 -2
- package/lib/services/manifest-service.js +13 -16
- package/lib/services/manifest-service.js.map +1 -1
- package/lib/services/output-service.d.ts +1 -1
- package/lib/services/output-service.js +10 -13
- package/lib/services/output-service.js.map +1 -1
- package/messages/delta.test-classes.md +28 -24
- package/oclif.manifest.json +51 -24
- package/package.json +12 -11
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/* eslint-disable class-methods-use-this */
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class DependencyService {
|
|
2
|
+
import { sortBy } from '@salesforce/kit';
|
|
3
|
+
import lodash from 'lodash';
|
|
4
|
+
import { APEX_CLASS, defaultTypesToFetchFromDependencyServer } from '../elements/object-types.js';
|
|
5
|
+
export class DependencyService {
|
|
6
|
+
connection;
|
|
9
7
|
connect(connection) {
|
|
10
8
|
this.connection = connection;
|
|
11
9
|
}
|
|
12
10
|
async getDependenciesByObjects(additionalObjects = []) {
|
|
13
|
-
const objects = new Set([...
|
|
11
|
+
const objects = new Set([...defaultTypesToFetchFromDependencyServer, ...additionalObjects]);
|
|
14
12
|
const promises = [];
|
|
15
13
|
objects.forEach((object) => promises.push(this.getDependencyByObject(object)));
|
|
16
14
|
const results = await Promise.all(promises);
|
|
17
15
|
// return oua;
|
|
18
|
-
return
|
|
16
|
+
return lodash.uniqBy(results.flat(), (result) => result.MetadataComponentName +
|
|
19
17
|
result.MetadataComponentType +
|
|
20
18
|
result.RefMetadataComponentName +
|
|
21
19
|
result.RefMetadataComponentType);
|
|
@@ -28,9 +26,9 @@ class DependencyService {
|
|
|
28
26
|
directDependencies.add(depData);
|
|
29
27
|
}
|
|
30
28
|
}
|
|
31
|
-
const dependencies = Array.from(this.getRelations(dependencyList.filter((depData) => depData.RefMetadataComponentType ===
|
|
32
|
-
return
|
|
33
|
-
.filter((dependency) => dependency.MetadataComponentType ===
|
|
29
|
+
const dependencies = Array.from(this.getRelations(dependencyList.filter((depData) => depData.RefMetadataComponentType === APEX_CLASS), directDependencies));
|
|
30
|
+
return lodash.uniq(dependencies
|
|
31
|
+
.filter((dependency) => dependency.MetadataComponentType === APEX_CLASS)
|
|
34
32
|
.map((dependency) => dependency.MetadataComponentName));
|
|
35
33
|
}
|
|
36
34
|
getRelations(dependenciesRelatingToApex, relatedDependencies, relationCounter = 0) {
|
|
@@ -60,22 +58,21 @@ class DependencyService {
|
|
|
60
58
|
}
|
|
61
59
|
const dependencies = await this.connection.tooling.query(this.getDependencySoql(objectType));
|
|
62
60
|
const refDependencies = await this.connection.tooling.query(this.getRefDependencySoql(objectType));
|
|
63
|
-
return
|
|
61
|
+
return sortBy([...dependencies.records, ...refDependencies.records], ['MetadataComponentType', 'RefMetadataComponentType']);
|
|
64
62
|
}
|
|
65
63
|
getDependencySoql(objectType) {
|
|
66
|
-
return `SELECT MetadataComponentName, MetadataComponentType, RefMetadataComponentName, RefMetadataComponentType
|
|
67
|
-
FROM MetadataComponentDependency
|
|
68
|
-
WHERE MetadataComponentType = '${objectType}'
|
|
69
|
-
AND MetadataComponentNamespace = NULL
|
|
64
|
+
return `SELECT MetadataComponentName, MetadataComponentType, RefMetadataComponentName, RefMetadataComponentType
|
|
65
|
+
FROM MetadataComponentDependency
|
|
66
|
+
WHERE MetadataComponentType = '${objectType}'
|
|
67
|
+
AND MetadataComponentNamespace = NULL
|
|
70
68
|
AND RefMetadataComponentNamespace = NULL`;
|
|
71
69
|
}
|
|
72
70
|
getRefDependencySoql(objectType) {
|
|
73
|
-
return `SELECT MetadataComponentName, MetadataComponentType, RefMetadataComponentName, RefMetadataComponentType
|
|
74
|
-
FROM MetadataComponentDependency
|
|
75
|
-
WHERE RefMetadataComponentType = '${objectType}'
|
|
76
|
-
AND MetadataComponentNamespace = NULL
|
|
71
|
+
return `SELECT MetadataComponentName, MetadataComponentType, RefMetadataComponentName, RefMetadataComponentType
|
|
72
|
+
FROM MetadataComponentDependency
|
|
73
|
+
WHERE RefMetadataComponentType = '${objectType}'
|
|
74
|
+
AND MetadataComponentNamespace = NULL
|
|
77
75
|
AND RefMetadataComponentNamespace = NULL`;
|
|
78
76
|
}
|
|
79
77
|
}
|
|
80
|
-
exports.DependencyService = DependencyService;
|
|
81
78
|
//# sourceMappingURL=dependency-service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependency-service.js","sourceRoot":"","sources":["../../src/services/dependency-service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dependency-service.js","sourceRoot":"","sources":["../../src/services/dependency-service.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAG3C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,uCAAuC,EAAE,MAAM,6BAA6B,CAAC;AAUlG,MAAM,OAAO,iBAAiB;IACpB,UAAU,CAAyB;IAEpC,O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QACD,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CACtD,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CACnC,CAAC;QACF,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CACzD,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,CACtC,CAAC;QAEF,OAAO,MAAM,CACX,CAAC,GAAG,YAAY,CAAC,OAAO,EAAE,GAAG,eAAe,CAAC,OAAO,CAAC,EACrD,CAAC,uBAAuB,EAAE,0BAA0B,CAAC,CACtD,CAAC;IACJ,CAAC;IAEO,iBAAiB,CAAC,UAAkB;QAC1C,OAAO;;uCAE4B,UAAU;;iDAEA,CAAC;IAChD,CAAC;IAEO,oBAAoB,CAAC,UAAkB;QAC7C,OAAO;;0CAE+B,UAAU;;iDAEH,CAAC;IAChD,CAAC;CACF"}
|
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
// import { TestContext } from '@salesforce/core/lib/testSetup';
|
|
4
2
|
// import { stubSfCommandUx } from '@salesforce/sf-plugins-core';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import { readFileSync } from 'fs';
|
|
4
|
+
import { expect } from 'chai';
|
|
5
|
+
import { DependencyService } from './dependency-service.js';
|
|
8
6
|
describe('dependency-services', () => {
|
|
9
7
|
let dependencyService;
|
|
10
8
|
let dependencyList;
|
|
11
9
|
before(() => {
|
|
12
|
-
dependencyList = JSON.parse(
|
|
10
|
+
dependencyList = JSON.parse(readFileSync('test/fixtures/dependency-exploration-sf.json').toString());
|
|
13
11
|
});
|
|
14
12
|
beforeEach(() => {
|
|
15
|
-
dependencyService = new
|
|
13
|
+
dependencyService = new DependencyService();
|
|
16
14
|
});
|
|
17
15
|
describe('getRelatedApexClasses', () => {
|
|
18
16
|
it('test', () => {
|
|
19
17
|
const results = dependencyService.getRelatedApexClasses(dependencyList, ['APIUsers']);
|
|
20
|
-
|
|
18
|
+
expect(results).to.deep.eq(['APIUsers', 'APIUsersTest']);
|
|
21
19
|
});
|
|
22
20
|
});
|
|
23
21
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependency-services.test.js","sourceRoot":"","sources":["../../src/services/dependency-services.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dependency-services.test.js","sourceRoot":"","sources":["../../src/services/dependency-services.test.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,iEAAiE;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAA+B,MAAM,yBAAyB,CAAC;AAEzF,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,IAAI,iBAAoC,CAAC;IACzC,IAAI,cAA6C,CAAC;IAElD,MAAM,CAAC,GAAG,EAAE;QACV,cAAc,GAAG,IAAI,CAAC,KAAK,CACzB,YAAY,CAAC,8CAA8C,CAAC,CAAC,QAAQ,EAAE,CACvC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,UAAU,CAAC,GAAG,EAAE;QACd,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;QACrC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;YACd,MAAM,OAAO,GAAG,iBAAiB,CAAC,qBAAqB,CAAC,cAAc,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;YACtF,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { MetadataComponent } from './manifest-service.js';
|
|
2
|
+
export type FlowMetadata = {
|
|
3
|
+
apiName: string;
|
|
4
|
+
triggerType?: string;
|
|
5
|
+
processType?: string;
|
|
6
|
+
triggerObjectOrEvent?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare class FlowService {
|
|
9
|
+
private alwaysArray;
|
|
10
|
+
private xmlParser;
|
|
11
|
+
private logger;
|
|
12
|
+
/**
|
|
13
|
+
* Gets Flow names that require test coverage.
|
|
14
|
+
* If includeAllFlows is true, and any changed flow requires tests, return changed flows plus all flows that require tests.
|
|
15
|
+
* Otherwise, returns only the changed flows.
|
|
16
|
+
*/
|
|
17
|
+
getFlowNames(changedMetadataWithType: MetadataComponent[], includeAllFlows: boolean): Promise<string[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Extracts Flow metadata from local Flow definition files.
|
|
20
|
+
* Parses .flow-meta.xml files to get trigger information.
|
|
21
|
+
*/
|
|
22
|
+
getFlowMetadata(flowNames: string[], rootPath?: string): Promise<FlowMetadata[]>;
|
|
23
|
+
/**
|
|
24
|
+
* Gets trigger objects from Flow metadata.
|
|
25
|
+
*/
|
|
26
|
+
getTriggerObjectsFromFlows(flowNames: string[], rootPath?: string): Promise<Set<string>>;
|
|
27
|
+
/**
|
|
28
|
+
* Gets all Flow API names from local Flow definition files.
|
|
29
|
+
*/
|
|
30
|
+
getAllFlowNames(rootPath?: string): Promise<string[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Determines if a Flow requires test coverage.
|
|
33
|
+
* All processes and autolaunched flows require coverage, except Screen Flows.
|
|
34
|
+
*/
|
|
35
|
+
private flowRequiresTestCoverage;
|
|
36
|
+
/**
|
|
37
|
+
* Parses a Flow XML definition to extract trigger information.
|
|
38
|
+
*/
|
|
39
|
+
private parseFlowXml;
|
|
40
|
+
private isNotNullOrUndefined;
|
|
41
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/* eslint-disable class-methods-use-this */
|
|
2
|
+
import { parse as parsePath } from 'path';
|
|
3
|
+
import { readFile } from 'fs/promises';
|
|
4
|
+
import { glob } from 'glob';
|
|
5
|
+
import { XMLParser } from 'fast-xml-parser';
|
|
6
|
+
import { Logger } from '@salesforce/core';
|
|
7
|
+
import loadsh from 'lodash';
|
|
8
|
+
import { FLOW } from '../elements/object-types.js';
|
|
9
|
+
export class FlowService {
|
|
10
|
+
alwaysArray = ['Flow.processMetadataValues'];
|
|
11
|
+
xmlParser = new XMLParser({
|
|
12
|
+
ignoreAttributes: false,
|
|
13
|
+
parseAttributeValue: false,
|
|
14
|
+
trimValues: true,
|
|
15
|
+
isArray: (_, jpath) => this.alwaysArray.includes(jpath),
|
|
16
|
+
});
|
|
17
|
+
logger = new Logger('FlowService');
|
|
18
|
+
/**
|
|
19
|
+
* Gets Flow names that require test coverage.
|
|
20
|
+
* If includeAllFlows is true, and any changed flow requires tests, return changed flows plus all flows that require tests.
|
|
21
|
+
* Otherwise, returns only the changed flows.
|
|
22
|
+
*/
|
|
23
|
+
async getFlowNames(changedMetadataWithType, includeAllFlows) {
|
|
24
|
+
const changedFlows = changedMetadataWithType.filter((m) => m.type === FLOW).map((m) => m.name);
|
|
25
|
+
if (changedFlows.length === 0) {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
// Get metadata for changed flows to check if any require test coverage
|
|
29
|
+
const changedFlowMetadata = await this.getFlowMetadata(changedFlows);
|
|
30
|
+
const changedFlowsRequiringTests = changedFlowMetadata.filter((flow) => this.flowRequiresTestCoverage(flow));
|
|
31
|
+
this.logger.info('changedFlowMetadata', changedFlowMetadata);
|
|
32
|
+
this.logger.info('changedFlowsRequiringTests', changedFlowsRequiringTests);
|
|
33
|
+
if (changedFlowsRequiringTests.length && includeAllFlows) {
|
|
34
|
+
// Get all flows and filter to only those requiring test coverage
|
|
35
|
+
const allFlowNames = await this.getAllFlowNames();
|
|
36
|
+
const allFlowsRequiringTests = (await this.getFlowMetadata(allFlowNames))
|
|
37
|
+
.filter((flow) => this.flowRequiresTestCoverage(flow))
|
|
38
|
+
.map((flow) => flow.apiName);
|
|
39
|
+
this.logger.info('changedFlows', changedFlows);
|
|
40
|
+
this.logger.info('allFlowNames', allFlowNames);
|
|
41
|
+
this.logger.info('allFlowsRequiringTests', allFlowsRequiringTests);
|
|
42
|
+
return loadsh.uniq([...changedFlows, ...allFlowsRequiringTests]);
|
|
43
|
+
}
|
|
44
|
+
return changedFlows;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Extracts Flow metadata from local Flow definition files.
|
|
48
|
+
* Parses .flow-meta.xml files to get trigger information.
|
|
49
|
+
*/
|
|
50
|
+
async getFlowMetadata(flowNames, rootPath = 'force-app/main/default/flows') {
|
|
51
|
+
if (flowNames.length === 0) {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
const flowPaths = await Promise.all(flowNames.map(async (flowName) => {
|
|
55
|
+
const globPattern = `**/${flowName}.flow-meta.xml`;
|
|
56
|
+
return glob(globPattern, { cwd: rootPath });
|
|
57
|
+
}));
|
|
58
|
+
const flowMetadataPromises = flowPaths.flat().map(async (flowPath) => {
|
|
59
|
+
const fullPath = `${rootPath}/${flowPath}`;
|
|
60
|
+
const parsedPath = parsePath(fullPath);
|
|
61
|
+
const apiName = parsedPath.name.replace('.flow-meta', '');
|
|
62
|
+
try {
|
|
63
|
+
const fileContent = await readFile(fullPath, 'utf8');
|
|
64
|
+
const flowDef = this.parseFlowXml(fileContent);
|
|
65
|
+
return {
|
|
66
|
+
apiName,
|
|
67
|
+
triggerType: flowDef.triggerType,
|
|
68
|
+
processType: flowDef.processType,
|
|
69
|
+
triggerObjectOrEvent: flowDef.triggerObjectOrEvent,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
// If we can't parse a Flow file, skip it but log the issue
|
|
74
|
+
this.logger.warn(`Failed to parse Flow file ${fullPath}:`, error);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
const flowMetadata = await Promise.all(flowMetadataPromises);
|
|
78
|
+
return flowMetadata.filter(this.isNotNullOrUndefined);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Gets trigger objects from Flow metadata.
|
|
82
|
+
*/
|
|
83
|
+
async getTriggerObjectsFromFlows(flowNames, rootPath = 'force-app/main/default/flows') {
|
|
84
|
+
const flowMetadata = (await this.getFlowMetadata(flowNames, rootPath))
|
|
85
|
+
.map((flow) => flow.triggerObjectOrEvent)
|
|
86
|
+
.filter(this.isNotNullOrUndefined);
|
|
87
|
+
return new Set(flowMetadata);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Gets all Flow API names from local Flow definition files.
|
|
91
|
+
*/
|
|
92
|
+
async getAllFlowNames(rootPath = 'force-app/main/default/flows') {
|
|
93
|
+
const flowPaths = await glob('**/*.flow-meta.xml', { cwd: rootPath });
|
|
94
|
+
return flowPaths.map((flowPath) => {
|
|
95
|
+
const parsedPath = parsePath(flowPath);
|
|
96
|
+
return parsedPath.name.replace('.flow-meta', '');
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Determines if a Flow requires test coverage.
|
|
101
|
+
* All processes and autolaunched flows require coverage, except Screen Flows.
|
|
102
|
+
*/
|
|
103
|
+
flowRequiresTestCoverage(flow) {
|
|
104
|
+
// Screen flows are exempt from test coverage requirements
|
|
105
|
+
return flow.triggerType !== undefined || flow.processType !== 'Flow';
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Parses a Flow XML definition to extract trigger information.
|
|
109
|
+
*/
|
|
110
|
+
parseFlowXml(xmlContent) {
|
|
111
|
+
const result = this.xmlParser.parse(xmlContent);
|
|
112
|
+
const flow = result.Flow;
|
|
113
|
+
if (!flow) {
|
|
114
|
+
return {};
|
|
115
|
+
}
|
|
116
|
+
// Extract trigger type and object from the Flow definition
|
|
117
|
+
const triggerType = flow.start?.triggerType ?? flow.triggerType;
|
|
118
|
+
const processType = flow.processType;
|
|
119
|
+
let triggerObjectOrEvent = flow.start?.object;
|
|
120
|
+
// Check for processMetadataValues which might contain trigger info for older flows
|
|
121
|
+
if (flow.processMetadataValues) {
|
|
122
|
+
const metadataValues = flow.processMetadataValues;
|
|
123
|
+
const objectTypeMetadata = metadataValues.find((metadata) => metadata.name === 'ObjectType' && metadata.value?.stringValue);
|
|
124
|
+
if (objectTypeMetadata?.value?.stringValue) {
|
|
125
|
+
triggerObjectOrEvent = objectTypeMetadata.value.stringValue;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
triggerType,
|
|
130
|
+
processType,
|
|
131
|
+
triggerObjectOrEvent,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
isNotNullOrUndefined = (value) => value !== undefined && value !== null;
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=flow-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-service.js","sourceRoot":"","sources":["../../src/services/flow-service.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAE3C,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAkCnD,MAAM,OAAO,WAAW;IACd,WAAW,GAAG,CAAC,4BAA4B,CAAC,CAAC;IAC7C,SAAS,GAAG,IAAI,SAAS,CAAC;QAChC,gBAAgB,EAAE,KAAK;QACvB,mBAAmB,EA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AAC;IACJ,CAAC;IAEO,oBAAoB,GAAG,CAAI,KAA2B,EAAc,EAAE,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC;CACtH"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { ResolveManifestResult } from '@salesforce/source-deploy-retrieve/lib/src/resolve/manifestResolver';
|
|
1
|
+
import { ResolveManifestResult } from '@salesforce/source-deploy-retrieve/lib/src/resolve/manifestResolver.js';
|
|
2
|
+
export type MetadataComponent = {
|
|
3
|
+
name: string;
|
|
4
|
+
type: string;
|
|
5
|
+
};
|
|
2
6
|
export declare class ManifestService {
|
|
3
7
|
parseManifest(path?: string): Promise<ResolveManifestResult>;
|
|
4
|
-
|
|
8
|
+
extractMetadataComponentsWithType(manifestData: ResolveManifestResult): MetadataComponent[];
|
|
5
9
|
}
|
|
@@ -1,37 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const object_types_1 = require("../elements/object-types");
|
|
6
|
-
class ManifestService {
|
|
7
|
-
// eslint-disable-next-line class-methods-use-this
|
|
1
|
+
/* eslint-disable class-methods-use-this */
|
|
2
|
+
import { ManifestResolver } from '@salesforce/source-deploy-retrieve';
|
|
3
|
+
import { meaningfulMetadataChanges } from '../elements/object-types.js';
|
|
4
|
+
export class ManifestService {
|
|
8
5
|
async parseManifest(path = 'manifest/package.xml') {
|
|
9
|
-
const manifestResolver = new
|
|
6
|
+
const manifestResolver = new ManifestResolver();
|
|
10
7
|
return manifestResolver.resolve(path);
|
|
11
8
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const componentNames = new Set();
|
|
9
|
+
extractMetadataComponentsWithType(manifestData) {
|
|
10
|
+
const componentMap = new Map();
|
|
15
11
|
for (const component of manifestData.components) {
|
|
16
12
|
// Metadata can have a wildcard, we don't support this today
|
|
17
13
|
if (component.fullName === '*') {
|
|
18
14
|
continue;
|
|
19
15
|
}
|
|
20
16
|
// Only include metadata that we care about. Aka: meaningful
|
|
21
|
-
if (!
|
|
17
|
+
if (!meaningfulMetadataChanges.includes(component.type.name)) {
|
|
22
18
|
continue;
|
|
23
19
|
}
|
|
24
20
|
// Children components, we want to get the parent. Example: `Account.Name` -> `Account`
|
|
21
|
+
let name;
|
|
25
22
|
if (component.fullName.includes('.')) {
|
|
26
23
|
const splitComponentName = component.fullName.split('.');
|
|
27
|
-
|
|
24
|
+
name = splitComponentName[0];
|
|
28
25
|
}
|
|
29
26
|
else {
|
|
30
|
-
|
|
27
|
+
name = component.fullName;
|
|
31
28
|
}
|
|
29
|
+
componentMap.set(name, { name, type: component.type.name });
|
|
32
30
|
}
|
|
33
|
-
return Array.from(
|
|
31
|
+
return Array.from(componentMap.values());
|
|
34
32
|
}
|
|
35
33
|
}
|
|
36
|
-
exports.ManifestService = ManifestService;
|
|
37
34
|
//# sourceMappingURL=manifest-service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest-service.js","sourceRoot":"","sources":["../../src/services/manifest-service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"manifest-service.js","sourceRoot":"","sources":["../../src/services/manifest-service.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAE3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAEtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAOxE,MAAM,OAAO,eAAe;IACnB,KAAK,CAAC,aAAa,CAAC,IAAI,GAAG,sBAAsB;QACtD,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAC;QAChD,OAAO,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAEM,iCAAiC,CAAC,YAAmC;QAC1E,MAAM,YAAY,GAAG,IAAI,GAAG,EAA6B,CAAC;QAC1D,KAAK,MAAM,SAAS,IAAI,YAAY,CAAC,UAAU,EAAE,CAAC;YAChD,4DAA4D;YAC5D,IAAI,SAAS,CAAC,QAAQ,KAAK,GAAG,EAAE,CAAC;gBAC/B,SAAS;YACX,CAAC;YAED,4DAA4D;YAC5D,IAAI,CAAC,yBAAyB,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC7D,SAAS;YACX,CAAC;YAED,uFAAuF;YACvF,IAAI,IAAY,CAAC;YACjB,IAAI,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBACrC,MAAM,kBAAkB,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACzD,IAAI,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC;YAC/B,CAAC;iBAAM,CAAC;gBACN,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC;YAC5B,CAAC;YAED,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9D,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;IAC3C,CAAC;CACF"}
|
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const fs_1 = require("fs");
|
|
7
|
-
class OutputService {
|
|
1
|
+
import { resolve, join } from 'path';
|
|
2
|
+
import { writeFile, access, mkdir } from 'fs/promises';
|
|
3
|
+
import { constants } from 'fs';
|
|
4
|
+
export class OutputService {
|
|
5
|
+
outputFolder;
|
|
8
6
|
constructor(outputFolder = '.sf-delta-tests') {
|
|
9
|
-
this.outputFolder =
|
|
7
|
+
this.outputFolder = resolve(outputFolder);
|
|
10
8
|
}
|
|
11
9
|
async dependencyData(dependencyData) {
|
|
12
10
|
return this.write('dependency-graph.json', JSON.stringify(dependencyData));
|
|
13
11
|
}
|
|
14
12
|
async write(fileName, data) {
|
|
15
|
-
const path =
|
|
13
|
+
const path = join(this.outputFolder, fileName);
|
|
16
14
|
try {
|
|
17
|
-
await
|
|
15
|
+
await access(this.outputFolder, constants.W_OK);
|
|
18
16
|
}
|
|
19
17
|
catch {
|
|
20
|
-
await
|
|
18
|
+
await mkdir(this.outputFolder);
|
|
21
19
|
}
|
|
22
|
-
return
|
|
20
|
+
return writeFile(path, data);
|
|
23
21
|
}
|
|
24
22
|
}
|
|
25
|
-
exports.OutputService = OutputService;
|
|
26
23
|
//# sourceMappingURL=output-service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-service.js","sourceRoot":"","sources":["../../src/services/output-service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"output-service.js","sourceRoot":"","sources":["../../src/services/output-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAG/B,MAAM,OAAO,aAAa;IACP,YAAY,CAAS;IACtC,YAAmB,YAAY,GAAG,iBAAiB;QACjD,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC5C,CAAC;IACM,KAAK,CAAC,cAAc,CAAC,cAA6C;QACvE,OAAO,IAAI,CAAC,KAAK,CAAC,uBAAuB,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC;IAC7E,CAAC;IAEO,KAAK,CAAC,KAAK,CAAC,QAAgB,EAAE,IAAY;QAChD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QAE/C,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;QAClD,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACjC,CAAC;QAED,OAAO,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF"}
|
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
# summary
|
|
2
|
-
|
|
3
|
-
Run only related tests
|
|
4
|
-
|
|
5
|
-
# description
|
|
6
|
-
|
|
7
|
-
Calculates the tests needed to be ran based on the changed metadata given using the Salesforce Dependency API
|
|
8
|
-
|
|
9
|
-
# examples
|
|
10
|
-
|
|
11
|
-
testCmd=$(sf delta test-classes --target-org matt@never.io.dev)
|
|
12
|
-
sf project deploy validate ${testCmd}
|
|
13
|
-
|
|
14
|
-
# flags.target-org.summary
|
|
15
|
-
|
|
16
|
-
The org you want to check the dependencies against.
|
|
17
|
-
|
|
18
|
-
# flags.package-path.summary
|
|
19
|
-
|
|
20
|
-
Path to the package.xml that will be deployed.
|
|
21
|
-
|
|
22
|
-
# flags.always-run-test.summary
|
|
23
|
-
|
|
24
|
-
A test class to run when no tests need to be ran.
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Run only related tests
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Calculates the tests needed to be ran based on the changed metadata given using the Salesforce Dependency API
|
|
8
|
+
|
|
9
|
+
# examples
|
|
10
|
+
|
|
11
|
+
testCmd=$(sf delta test-classes --target-org matt@never.io.dev)
|
|
12
|
+
sf project deploy validate ${testCmd}
|
|
13
|
+
|
|
14
|
+
# flags.target-org.summary
|
|
15
|
+
|
|
16
|
+
The org you want to check the dependencies against.
|
|
17
|
+
|
|
18
|
+
# flags.package-path.summary
|
|
19
|
+
|
|
20
|
+
Path to the package.xml that will be deployed.
|
|
21
|
+
|
|
22
|
+
# flags.always-run-test.summary
|
|
23
|
+
|
|
24
|
+
A test class to run when no tests need to be ran.
|
|
25
|
+
|
|
26
|
+
# flags.include-all-flows.summary
|
|
27
|
+
|
|
28
|
+
When enabled, if any Flow is changed, include all Flows that require test coverage based on their trigger type or process type. This ensures proper test coverage validation since Salesforce checks coverage for all such Flows during deployment, not just the changed ones. Use --no-include-all-flows to disable.
|
package/oclif.manifest.json
CHANGED
|
@@ -1,51 +1,78 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.27",
|
|
3
2
|
"commands": {
|
|
4
3
|
"delta:test-classes": {
|
|
5
|
-
"id": "delta:test-classes",
|
|
6
|
-
"summary": "Run only related tests",
|
|
7
|
-
"description": "Calculates the tests needed to be ran based on the changed metadata given using the Salesforce Dependency API",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"pluginName": "sf-delta-tests",
|
|
10
|
-
"pluginAlias": "sf-delta-tests",
|
|
11
|
-
"pluginType": "core",
|
|
12
4
|
"aliases": [],
|
|
5
|
+
"args": {},
|
|
6
|
+
"description": "Calculates the tests needed to be ran based on the changed metadata given using the Salesforce Dependency API",
|
|
13
7
|
"examples": [
|
|
14
|
-
"testCmd=$(sf delta test-classes --target-org matt@never.io.dev)\nsf project deploy validate ${testCmd}"
|
|
8
|
+
"testCmd=$(sf delta test-classes --target-org matt@never.io.dev)\r\nsf project deploy validate ${testCmd}"
|
|
15
9
|
],
|
|
16
10
|
"flags": {
|
|
17
11
|
"json": {
|
|
18
|
-
"name": "json",
|
|
19
|
-
"type": "boolean",
|
|
20
12
|
"description": "Format output as json.",
|
|
21
13
|
"helpGroup": "GLOBAL",
|
|
22
|
-
"
|
|
14
|
+
"name": "json",
|
|
15
|
+
"allowNo": false,
|
|
16
|
+
"type": "boolean"
|
|
17
|
+
},
|
|
18
|
+
"flags-dir": {
|
|
19
|
+
"helpGroup": "GLOBAL",
|
|
20
|
+
"name": "flags-dir",
|
|
21
|
+
"summary": "Import flag values from a directory.",
|
|
22
|
+
"hasDynamicHelp": false,
|
|
23
|
+
"multiple": false,
|
|
24
|
+
"type": "option"
|
|
23
25
|
},
|
|
24
26
|
"target-org": {
|
|
25
|
-
"name": "target-org",
|
|
26
|
-
"type": "option",
|
|
27
27
|
"char": "o",
|
|
28
|
-
"
|
|
28
|
+
"name": "target-org",
|
|
29
|
+
"noCacheDefault": true,
|
|
29
30
|
"required": true,
|
|
30
|
-
"
|
|
31
|
+
"summary": "The org you want to check the dependencies against.",
|
|
32
|
+
"hasDynamicHelp": true,
|
|
33
|
+
"multiple": false,
|
|
34
|
+
"type": "option"
|
|
31
35
|
},
|
|
32
36
|
"package-path": {
|
|
33
|
-
"name": "package-path",
|
|
34
|
-
"type": "option",
|
|
35
37
|
"char": "p",
|
|
38
|
+
"name": "package-path",
|
|
36
39
|
"summary": "Path to the package.xml that will be deployed.",
|
|
40
|
+
"default": "manifest/package.xml",
|
|
41
|
+
"hasDynamicHelp": false,
|
|
37
42
|
"multiple": false,
|
|
38
|
-
"
|
|
43
|
+
"type": "option"
|
|
39
44
|
},
|
|
40
45
|
"always-run-test": {
|
|
41
46
|
"name": "always-run-test",
|
|
42
|
-
"type": "option",
|
|
43
47
|
"summary": "A test class to run when no tests need to be ran.",
|
|
44
|
-
"
|
|
48
|
+
"hasDynamicHelp": false,
|
|
49
|
+
"multiple": true,
|
|
50
|
+
"type": "option"
|
|
51
|
+
},
|
|
52
|
+
"include-all-flows": {
|
|
53
|
+
"name": "include-all-flows",
|
|
54
|
+
"summary": "When enabled, if any Flow is changed, include all Flows that require test coverage based on their trigger type or process type. This ensures proper test coverage validation since Salesforce checks coverage for all such Flows during deployment, not just the changed ones. Use --no-include-all-flows to disable.",
|
|
55
|
+
"allowNo": true,
|
|
56
|
+
"type": "boolean"
|
|
45
57
|
}
|
|
46
58
|
},
|
|
47
|
-
"
|
|
48
|
-
"
|
|
59
|
+
"hasDynamicHelp": true,
|
|
60
|
+
"hiddenAliases": [],
|
|
61
|
+
"id": "delta:test-classes",
|
|
62
|
+
"pluginAlias": "sf-delta-tests",
|
|
63
|
+
"pluginName": "sf-delta-tests",
|
|
64
|
+
"pluginType": "core",
|
|
65
|
+
"strict": true,
|
|
66
|
+
"summary": "Run only related tests",
|
|
67
|
+
"enableJsonFlag": true,
|
|
68
|
+
"isESM": true,
|
|
69
|
+
"relativePath": [
|
|
70
|
+
"lib",
|
|
71
|
+
"commands",
|
|
72
|
+
"delta",
|
|
73
|
+
"test-classes.js"
|
|
74
|
+
]
|
|
49
75
|
}
|
|
50
|
-
}
|
|
76
|
+
},
|
|
77
|
+
"version": "0.1.0"
|
|
51
78
|
}
|