sf-delta-tests 0.0.20 → 0.0.21

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.
@@ -4,22 +4,24 @@ import { DependencyService } from '../../services/dependency-service';
4
4
  import { ApexClassService } from '../../services/apex-class-service';
5
5
  import { ManifestService } from '../../services/manifest-service';
6
6
  import { OutputService } from '../../services/output-service';
7
+ import { CliService } from '../../services/cli-service';
7
8
  export type DeltaTestClassesResult = {
8
- testFiles: string[];
9
+ testNames: string[];
10
+ cli: string;
9
11
  };
10
12
  export default class TestClasses extends SfCommand<DeltaTestClassesResult> {
11
13
  static readonly summary: string;
12
14
  static readonly description: string;
13
15
  static readonly examples: string[];
14
16
  static readonly flags: {
15
- name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
16
17
  'target-org': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
17
- 'changed-metadata': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
18
+ 'package-path': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
18
19
  };
19
20
  private dependencyService;
20
21
  private apexClassService;
21
22
  private outputService;
22
23
  private manifestService;
23
- constructor(argv: string[], config: Config, dependencyService?: DependencyService, apexClassService?: ApexClassService, outputService?: OutputService, manifestService?: ManifestService);
24
+ private cliService;
25
+ constructor(argv: string[], config: Config, dependencyService?: DependencyService, apexClassService?: ApexClassService, outputService?: OutputService, manifestService?: ManifestService, cliService?: CliService);
24
26
  run(): Promise<DeltaTestClassesResult>;
25
27
  }
@@ -6,65 +6,95 @@ const dependency_service_1 = require("../../services/dependency-service");
6
6
  const apex_class_service_1 = require("../../services/apex-class-service");
7
7
  const manifest_service_1 = require("../../services/manifest-service");
8
8
  const output_service_1 = require("../../services/output-service");
9
+ const cli_service_1 = require("../../services/cli-service");
9
10
  core_1.Messages.importMessagesDirectory(__dirname);
10
11
  const messages = core_1.Messages.loadMessages('sf-delta-tests', 'delta.test-classes');
11
12
  class TestClasses extends sf_plugins_core_1.SfCommand {
12
- constructor(argv, config, dependencyService = new dependency_service_1.DependencyService(), apexClassService = new apex_class_service_1.ApexClassService(), outputService = new output_service_1.OutputService(), manifestService = new manifest_service_1.ManifestService()) {
13
+ constructor(argv, config, dependencyService = new dependency_service_1.DependencyService(), apexClassService = new apex_class_service_1.ApexClassService(), outputService = new output_service_1.OutputService(), manifestService = new manifest_service_1.ManifestService(), cliService = new cli_service_1.CliService()) {
13
14
  super(argv, config);
14
15
  this.dependencyService = dependencyService;
15
16
  this.apexClassService = apexClassService;
16
17
  this.outputService = outputService;
17
18
  this.manifestService = manifestService;
19
+ this.cliService = cliService;
18
20
  }
19
21
  async run() {
20
22
  try {
21
23
  const { flags } = await this.parse(TestClasses);
24
+ // Connect to SF org
22
25
  const org = flags['target-org'];
23
26
  const conn = org.getConnection(undefined);
24
27
  this.dependencyService.connect(conn);
28
+ // Download all dependencies from SF
25
29
  const combinedApexClassData = await this.dependencyService.getDependenciesByObjects();
26
- const outputPromises = [this.outputService.dependencyData(combinedApexClassData)];
27
- await Promise.all(outputPromises);
28
- const manifestData = await this.manifestService.parseManifest();
30
+ // Write into output folder
31
+ await this.outputService.dependencyData(combinedApexClassData);
32
+ // Get manifest data and transform that into a list of metadata
33
+ const manifestData = await this.manifestService.parseManifest(flags['package-path']);
29
34
  const changedMetadata = this.manifestService.extractMetadataComponents(manifestData);
35
+ this.debug({ manifestData: manifestData.components, changedMetadata });
36
+ // If no meaningful changed metadata, no need to run tests (layout changes don't need tests!)
37
+ if (changedMetadata.length === 0) {
38
+ this.debug('No meaningful changed metadata, do not run any tests. (example, layout changes do not need tests ran)');
39
+ this.log(this.cliService.noTests());
40
+ return {
41
+ testNames: [],
42
+ cli: this.cliService.noTests(),
43
+ };
44
+ }
45
+ // Too many changes, just run all
46
+ if (changedMetadata.length > 40) {
47
+ this.debug(`Found over 40 changed metadata items (${changedMetadata.length}), running all tests`);
48
+ this.log(this.cliService.allTests());
49
+ return { testNames: [], cli: this.cliService.allTests() };
50
+ }
51
+ // The magic function. From the changed metadata get all the Apex Classes that could be connected to the changed metadata
30
52
  const classList = this.dependencyService.getRelatedApexClasses(combinedApexClassData, changedMetadata);
31
- const testFiles = await this.apexClassService.filterApexTest(classList);
32
- const simpleTestFiles = this.apexClassService.filterApexTestSimple(classList);
33
- this.debug({ testFiles, simpleTestFiles });
53
+ this.debug({ classList });
54
+ // Filter the total class list to only tests
55
+ const testNames = await this.apexClassService.filterApexTest(classList);
56
+ const simpleTestNames = this.apexClassService.filterApexTestSimple(classList);
57
+ this.debug({ testFiles: testNames, simpleTestNames });
58
+ if (testNames.length === 0) {
59
+ this.debug('No relevant tests found, skip running tests');
60
+ // TODO: Debate this one, if we found no relevant tests, should all or none be ran?
61
+ this.log(this.cliService.noTests());
62
+ return {
63
+ testNames: [],
64
+ cli: this.cliService.noTests(),
65
+ };
66
+ }
67
+ this.debug(`Found meaningful and related tests: ${testNames.join(', ')}`);
34
68
  // Actual meaningful output
35
- this.log(testFiles.join(','));
69
+ this.log(this.cliService.specificTests(testNames));
36
70
  return {
37
- testFiles,
71
+ testNames,
72
+ cli: this.cliService.specificTests(testNames),
38
73
  };
39
74
  }
40
75
  catch (e) {
41
76
  if (e instanceof Error) {
42
- this.log('Unknown error');
43
77
  this.error([e.toString(), e.name, e.stack].join('\n'), { exit: false });
44
78
  }
45
- return { testFiles: [] };
79
+ this.log(this.cliService.allTests());
80
+ return { testNames: [], cli: this.cliService.allTests() };
46
81
  }
47
82
  }
48
83
  }
49
84
  TestClasses.summary = messages.getMessage('summary');
50
85
  TestClasses.description = messages.getMessage('description');
51
86
  TestClasses.examples = messages.getMessages('examples');
87
+ // TODO: Add in parameters to tune the max revision depth, max changed metadata
52
88
  TestClasses.flags = {
53
- name: sf_plugins_core_1.Flags.string({
54
- summary: messages.getMessage('flags.name.summary'),
55
- description: messages.getMessage('flags.name.description'),
56
- char: 'n',
57
- required: false,
58
- }),
59
89
  'target-org': sf_plugins_core_1.Flags.requiredOrg({
60
90
  summary: messages.getMessage('flags.target-org.summary'),
61
91
  char: 'o',
62
92
  required: true,
63
93
  }),
64
- 'changed-metadata': sf_plugins_core_1.Flags.string({
65
- summary: messages.getMessage('flags.changed-metadata.summary'),
66
- char: 'c',
67
- required: false,
94
+ 'package-path': sf_plugins_core_1.Flags.string({
95
+ summary: messages.getMessage('flags.package-path.summary'),
96
+ char: 'p',
97
+ default: 'manifest/package.xml',
68
98
  }),
69
99
  };
70
100
  exports.default = TestClasses;
@@ -1 +1 @@
1
- {"version":3,"file":"test-classes.js","sourceRoot":"","sources":["../../../src/commands/delta/test-classes.ts"],"names":[],"mappings":";;AAAA,iEAA+D;AAC/D,2CAA4C;AAE5C,0EAAsE;AACtE,0EAAqE;AACrE,sEAAkE;AAClE,kEAA8D;AAE9D,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,gBAAgB,EAAE,oBAAoB,CAAC,CAAC;AAM/E,MAAqB,WAAY,SAAQ,2BAAiC;IA6BxE,YACE,IAAc,EACd,MAAc,EACd,iBAAiB,GAAG,IAAI,sCAAiB,EAAE,EAC3C,gBAAgB,GAAG,IAAI,qCAAgB,EAAE,EACzC,aAAa,GAAG,IAAI,8BAAa,EAAE,EACnC,eAAe,GAAG,IAAI,kCAAe,EAAE;QAEvC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACpB,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,CAAC;IAEM,KAA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AAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACzC,uBAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,oBAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAEnE,+EAA+E;AACxD,iBAAK,GAAG;IAC7B,YAAY,EAAE,uBAAK,CAAC,WAAW,CAAC;QAC9B,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,0BAA0B,CAAC;QACxD,IAAI,EAAE,GAAG;QACT,QAAQ,EAAE,IAAI;KACf,CAAC;IACF,cAAc,EAAE,uBAAK,CAAC,MAAM,CAAC;QAC3B,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,4BAA4B,CAAC;QAC1D,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,sBAAsB;KAChC,CAAC;CACH,CAAC;kBAjBiB,WAAW"}
@@ -0,0 +1,8 @@
1
+ export declare const APEX_CLASS = "ApexClass";
2
+ export declare const APEX_TRIGGER = "ApexTrigger";
3
+ export declare const CUSTOM_OBJECT = "CustomObject";
4
+ export declare const FLOW = "Flow";
5
+ export declare const LIGHTNING_COMPONENT_BUNDLE = "LightningComponentBundle";
6
+ export declare const AURA_DEFINITION_BUNDLE = "AuraDefinitionBundle";
7
+ export declare const defaultTypesToFetchFromDependencyServer: string[];
8
+ export declare const meaningfulMetadataChanges: string[];
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.meaningfulMetadataChanges = exports.defaultTypesToFetchFromDependencyServer = exports.AURA_DEFINITION_BUNDLE = exports.LIGHTNING_COMPONENT_BUNDLE = exports.FLOW = exports.CUSTOM_OBJECT = exports.APEX_TRIGGER = exports.APEX_CLASS = void 0;
4
+ exports.APEX_CLASS = 'ApexClass';
5
+ exports.APEX_TRIGGER = 'ApexTrigger';
6
+ exports.CUSTOM_OBJECT = 'CustomObject';
7
+ exports.FLOW = 'Flow';
8
+ exports.LIGHTNING_COMPONENT_BUNDLE = 'LightningComponentBundle';
9
+ exports.AURA_DEFINITION_BUNDLE = 'AuraDefinitionBundle';
10
+ exports.defaultTypesToFetchFromDependencyServer = [
11
+ exports.APEX_CLASS,
12
+ exports.APEX_TRIGGER,
13
+ exports.CUSTOM_OBJECT,
14
+ exports.FLOW,
15
+ exports.LIGHTNING_COMPONENT_BUNDLE,
16
+ exports.AURA_DEFINITION_BUNDLE,
17
+ ];
18
+ // TODO: Review
19
+ exports.meaningfulMetadataChanges = [
20
+ exports.APEX_CLASS,
21
+ exports.APEX_TRIGGER,
22
+ exports.CUSTOM_OBJECT,
23
+ exports.FLOW,
24
+ exports.LIGHTNING_COMPONENT_BUNDLE,
25
+ exports.AURA_DEFINITION_BUNDLE,
26
+ ];
27
+ //# sourceMappingURL=object-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-types.js","sourceRoot":"","sources":["../../src/elements/object-types.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG,WAAW,CAAC;AACzB,QAAA,YAAY,GAAG,aAAa,CAAC;AAC7B,QAAA,aAAa,GAAG,cAAc,CAAC;AAC/B,QAAA,IAAI,GAAG,MAAM,CAAC;AACd,QAAA,0BAA0B,GAAG,0BAA0B,CAAC;AACxD,QAAA,sBAAsB,GAAG,sBAAsB,CAAC;AAEhD,QAAA,uCAAuC,GAAG;IACrD,kBAAU;IACV,oBAAY;IACZ,qBAAa;IACb,YAAI;IACJ,kCAA0B;IAC1B,8BAAsB;CACvB,CAAC;AAEF,eAAe;AACF,QAAA,yBAAyB,GAAG;IACvC,kBAAU;IACV,oBAAY;IACZ,qBAAa;IACb,YAAI;IACJ,kCAA0B;IAC1B,8BAAsB;CACvB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare class CliService {
2
+ specificTests(tests: string[]): string;
3
+ allTests(): string;
4
+ noTests(): string;
5
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CliService = void 0;
4
+ /* eslint-disable class-methods-use-this */
5
+ class CliService {
6
+ specificTests(tests) {
7
+ return `--test-level RunSpecifiedTests --tests "${tests.join(',')}"`;
8
+ }
9
+ allTests() {
10
+ return '--test-level RunLocalTests';
11
+ }
12
+ noTests() {
13
+ return '';
14
+ }
15
+ }
16
+ exports.CliService = CliService;
17
+ //# sourceMappingURL=cli-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-service.js","sourceRoot":"","sources":["../../src/services/cli-service.ts"],"names":[],"mappings":";;;AAAA,2CAA2C;AAC3C,MAAa,UAAU;IACd,aAAa,CAAC,KAAe;QAClC,OAAO,2CAA2C,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IACvE,CAAC;IAEM,QAAQ;QACb,OAAO,4BAA4B,CAAC;IACtC,CAAC;IAEM,OAAO;QACZ,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAZD,gCAYC"}
@@ -1,23 +1,16 @@
1
1
  "use strict";
2
+ /* eslint-disable class-methods-use-this */
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.DependencyService = void 0;
4
5
  const kit_1 = require("@salesforce/kit");
5
6
  const lodash_1 = require("lodash");
6
- const APEX_CLASS = 'ApexClass';
7
- const DEFAULT_OBJECTS = [
8
- APEX_CLASS,
9
- 'ApexTrigger',
10
- 'CustomObject',
11
- 'Flow',
12
- 'LightningComponentBundle',
13
- 'AuraDefinitionBundle',
14
- ];
7
+ const object_types_1 = require("../elements/object-types");
15
8
  class DependencyService {
16
9
  connect(connection) {
17
10
  this.connection = connection;
18
11
  }
19
12
  async getDependenciesByObjects(additionalObjects = []) {
20
- const objects = new Set([...DEFAULT_OBJECTS, ...additionalObjects]);
13
+ const objects = new Set([...object_types_1.defaultTypesToFetchFromDependencyServer, ...additionalObjects]);
21
14
  const promises = [];
22
15
  objects.forEach((object) => promises.push(this.getDependencyByObject(object)));
23
16
  const results = await Promise.all(promises);
@@ -40,12 +33,11 @@ class DependencyService {
40
33
  .filter((dependency) => this.isApexClass(dependencyList, dependency))
41
34
  .map((dependency) => dependency.MetadataComponentName));
42
35
  }
43
- // eslint-disable-next-line class-methods-use-this
44
36
  isApexClass(dependencyList, dependency) {
45
37
  for (const metadata of dependencyList) {
46
- if ((metadata.MetadataComponentType === APEX_CLASS &&
38
+ if ((metadata.MetadataComponentType === object_types_1.APEX_CLASS &&
47
39
  metadata.MetadataComponentName === dependency.MetadataComponentName) ||
48
- (metadata.RefMetadataComponentType === APEX_CLASS &&
40
+ (metadata.RefMetadataComponentType === object_types_1.APEX_CLASS &&
49
41
  metadata.RefMetadataComponentName === dependency.MetadataComponentName)) {
50
42
  return true;
51
43
  }
@@ -54,31 +46,37 @@ class DependencyService {
54
46
  }
55
47
  getRelations(allDependencies, relatedDependencies, relationCounter = 0) {
56
48
  const newDependencies = Array.from(relatedDependencies);
57
- /* // eslint-disable-next-line no-console
58
- console.log({
59
- first: 'first',
60
- allDependenciesLength: allDependencies.length,
61
- relatedDependenciesSize: relatedDependencies.size,
62
- relationCounter,
63
- });*/
64
- // eslint-disable-next-line no-console
65
- // console.log('getRelations: before loop');
66
- for (const depData of allDependencies.filter((dep) => dep.RefMetadataComponentType === APEX_CLASS)) {
67
- const matchedDeps = newDependencies.filter((newDep) => newDep.MetadataComponentName === depData.RefMetadataComponentName);
68
- if (matchedDeps.length > 0) {
69
- matchedDeps.forEach((matchedDep) => newDependencies.push(matchedDep));
49
+ // TODO: Make more efficient, filters are probably not good here
50
+ /* for (const depData of allDependencies.filter((dep) => dep.RefMetadataComponentType === APEX_CLASS)) {
51
+ const matchedDeps = newDependencies.filter(
52
+ (newDep) => newDep.MetadataComponentName === depData.RefMetadataComponentName
53
+ );
54
+
55
+ if (matchedDeps.length > 0) {
56
+ matchedDeps.forEach((matchedDep) => newDependencies.push(matchedDep));
57
+ }
58
+ }*/
59
+ // Should be more efficient than above...
60
+ /* for (const depData of allDependencies) {
61
+ if (depData.RefMetadataComponentType === APEX_CLASS) {
62
+ for (const newDep of newDependencies) {
63
+ if (newDep.MetadataComponentName === depData.RefMetadataComponentName) {
64
+ newDependencies.push(newDep);
65
+ }
66
+ }
67
+ }
68
+ }*/
69
+ // Inverse
70
+ for (const newDep of newDependencies) {
71
+ for (const depData of allDependencies) {
72
+ if (newDep.MetadataComponentName === depData.RefMetadataComponentName) {
73
+ if (depData.RefMetadataComponentType === object_types_1.APEX_CLASS) {
74
+ newDependencies.push(depData);
75
+ }
76
+ }
70
77
  }
71
78
  }
72
- // eslint-disable-next-line no-console
73
- // console.log('getRelations: after loop');
74
79
  const newDependenciesSet = new Set(newDependencies);
75
- // eslint-disable-next-line no-console
76
- /* console.log({
77
- relationCounter,
78
- newDepCount: newDependenciesSet.size,
79
- allDepCount: allDependencies.length,
80
- relatedDepCount: relatedDependencies.size,
81
- });*/
82
80
  // Stop looking at more than 8 layers of relations
83
81
  if (relationCounter >= 8) {
84
82
  return newDependenciesSet;
@@ -96,7 +94,6 @@ class DependencyService {
96
94
  const refDependencies = await this.connection.tooling.query(this.getRefDependencySoql(objectType));
97
95
  return (0, kit_1.sortBy)([...dependencies.records, ...refDependencies.records], ['MetadataComponentType', 'RefMetadataComponentType']);
98
96
  }
99
- // eslint-disable-next-line class-methods-use-this
100
97
  getDependencySoql(objectType) {
101
98
  return `SELECT MetadataComponentName, MetadataComponentType, RefMetadataComponentName, RefMetadataComponentType
102
99
  FROM MetadataComponentDependency
@@ -104,7 +101,6 @@ class DependencyService {
104
101
  AND MetadataComponentNamespace = NULL
105
102
  AND RefMetadataComponentNamespace = NULL`;
106
103
  }
107
- // eslint-disable-next-line class-methods-use-this
108
104
  getRefDependencySoql(objectType) {
109
105
  return `SELECT MetadataComponentName, MetadataComponentType, RefMetadataComponentName, RefMetadataComponentType
110
106
  FROM MetadataComponentDependency
@@ -1 +1 @@
1
- {"version":3,"file":"dependency-service.js","sourceRoot":"","sources":["../../src/services/dependency-service.ts"],"names":[],"mappings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/B;iBACF;aACF;SACF;QAED,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,eAAe,CAAC,CAAC;QAEpD,kDAAkD;QAClD,IAAI,eAAe,IAAI,CAAC,EAAE;YACxB,OAAO,kBAAkB,CAAC;SAC3B;QAED,IAAI,kBAAkB,CAAC,IAAI,KAAK,mBAAmB,CAAC,IAAI,EAAE;YACxD,OAAO,IAAI,CAAC,YAAY,CAAC,eAAe,EAAE,kBAAkB,EAAE,eAAe,GAAG,CAAC,CAAC,CAAC;SACpF;QAED,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAEO,KAAK,CAAC,qBAAqB,CAAC,UAAkB;QACpD,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YACpB,MAAM,KAAK,CAAC,wBAAwB,CAAC,CAAC;SACvC;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,IAAA,YAAM,EACX,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;AAhJD,8CAgJC"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ManifestService = void 0;
4
4
  const source_deploy_retrieve_1 = require("@salesforce/source-deploy-retrieve");
5
+ const object_types_1 = require("../elements/object-types");
5
6
  class ManifestService {
6
7
  // eslint-disable-next-line class-methods-use-this
7
8
  async parseManifest(path = 'manifest/package.xml') {
@@ -16,6 +17,10 @@ class ManifestService {
16
17
  if (component.fullName === '*') {
17
18
  continue;
18
19
  }
20
+ // Only include metadata that we care about. Aka: meaningful
21
+ if (!object_types_1.meaningfulMetadataChanges.includes(component.type.name)) {
22
+ continue;
23
+ }
19
24
  // Children components, we want to get the parent. Example: `Account.Name` -> `Account`
20
25
  if (component.fullName.includes('.')) {
21
26
  const splitComponentName = component.fullName.split('.');
@@ -1 +1 @@
1
- {"version":3,"file":"manifest-service.js","sourceRoot":"","sources":["../../src/services/manifest-service.ts"],"names":[],"mappings":";;;AAAA,+EAAsE;AAGtE,MAAa,eAAe;IAC1B,kDAAkD;IAC3C,KAAK,CAAC,aAAa,CAAC,IAAI,GAAG,sBAAsB;QACtD,MAAM,gBAAgB,GAAG,IAAI,yCAAgB,EAAE,CAAC;QAChD,OAAO,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAED,kDAAkD;IAC3C,yBAAyB,CAAC,YAAmC;QAClE,MAAM,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;QACzC,KAAK,MAAM,SAAS,IAAI,YAAY,CAAC,UAAU,EAAE;YAC/C,4DAA4D;YAC5D,IAAI,SAAS,CAAC,QAAQ,KAAK,GAAG,EAAE;gBAC9B,SAAS;aACV;YAED,uFAAuF;YACvF,IAAI,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBACpC,MAAM,kBAAkB,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACzD,cAAc,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;aAC3C;iBAAM;gBACL,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;aACxC;SACF;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACpC,CAAC;CACF;AA3BD,0CA2BC"}
1
+ {"version":3,"file":"manifest-service.js","sourceRoot":"","sources":["../../src/services/manifest-service.ts"],"names":[],"mappings":";;;AAAA,+EAAsE;AAEtE,2DAAqE;AAErE,MAAa,eAAe;IAC1B,kDAAkD;IAC3C,KAAK,CAAC,aAAa,CAAC,IAAI,GAAG,sBAAsB;QACtD,MAAM,gBAAgB,GAAG,IAAI,yCAAgB,EAAE,CAAC;QAChD,OAAO,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAED,kDAAkD;IAC3C,yBAAyB,CAAC,YAAmC;QAClE,MAAM,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;QACzC,KAAK,MAAM,SAAS,IAAI,YAAY,CAAC,UAAU,EAAE;YAC/C,4DAA4D;YAC5D,IAAI,SAAS,CAAC,QAAQ,KAAK,GAAG,EAAE;gBAC9B,SAAS;aACV;YAED,4DAA4D;YAC5D,IAAI,CAAC,wCAAyB,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gBAC5D,SAAS;aACV;YAED,uFAAuF;YACvF,IAAI,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBACpC,MAAM,kBAAkB,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACzD,cAAc,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;aAC3C;iBAAM;gBACL,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;aACxC;SACF;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACpC,CAAC;CACF;AAhCD,0CAgCC"}
@@ -1,28 +1,20 @@
1
1
  # summary
2
2
 
3
- Calculates the tests needed to be ran based on the changed metadata given using the Salesforce Dependency API
3
+ Run only related tests
4
4
 
5
5
  # description
6
6
 
7
7
  Calculates the tests needed to be ran based on the changed metadata given using the Salesforce Dependency API
8
8
 
9
- # flags.name.summary
10
-
11
- Description of a flag.
12
-
13
- # flags.name.description
14
-
15
- More information about a flag. Don't repeat the summary.
16
-
17
9
  # examples
18
10
 
19
- - <%= config.bin %> <%= command.id %>
20
-
11
+ tests=$(sf delta test-classes --target-org matt@never.io.dev)
12
+ sf project deploy validate ${tests}
21
13
 
22
14
  # flags.target-org.summary
23
15
 
24
16
  The org you want to check the dependencies against.
25
17
 
26
- # flags.changed-metadata.summary
18
+ # flags.package-path.summary
27
19
 
28
- Comma seperated list of changed metadata.
20
+ Path to the package.xml that will be deployed.
@@ -1,9 +1,9 @@
1
1
  {
2
- "version": "0.0.20",
2
+ "version": "0.0.21",
3
3
  "commands": {
4
4
  "delta:test-classes": {
5
5
  "id": "delta:test-classes",
6
- "summary": "Calculates the tests needed to be ran based on the changed metadata given using the Salesforce Dependency API",
6
+ "summary": "Run only related tests",
7
7
  "description": "Calculates the tests needed to be ran based on the changed metadata given using the Salesforce Dependency API",
8
8
  "strict": true,
9
9
  "pluginName": "sf-delta-tests",
@@ -11,7 +11,7 @@
11
11
  "pluginType": "core",
12
12
  "aliases": [],
13
13
  "examples": [
14
- "<%= config.bin %> <%= command.id %>"
14
+ "tests=$(sf delta test-classes --target-org matt@never.io.dev)\nsf project deploy validate ${tests}"
15
15
  ],
16
16
  "flags": {
17
17
  "json": {
@@ -21,15 +21,6 @@
21
21
  "helpGroup": "GLOBAL",
22
22
  "allowNo": false
23
23
  },
24
- "name": {
25
- "name": "name",
26
- "type": "option",
27
- "char": "n",
28
- "summary": "Description of a flag.",
29
- "description": "More information about a flag. Don't repeat the summary.",
30
- "required": false,
31
- "multiple": false
32
- },
33
24
  "target-org": {
34
25
  "name": "target-org",
35
26
  "type": "option",
@@ -38,13 +29,13 @@
38
29
  "required": true,
39
30
  "multiple": false
40
31
  },
41
- "changed-metadata": {
42
- "name": "changed-metadata",
32
+ "package-path": {
33
+ "name": "package-path",
43
34
  "type": "option",
44
- "char": "c",
45
- "summary": "Comma seperated list of changed metadata.",
46
- "required": false,
47
- "multiple": false
35
+ "char": "p",
36
+ "summary": "Path to the package.xml that will be deployed.",
37
+ "multiple": false,
38
+ "default": "manifest/package.xml"
48
39
  }
49
40
  },
50
41
  "args": {},
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sf-delta-tests",
3
3
  "description": "Calculate dependencies and scope to relevant tests",
4
- "version": "0.0.20",
4
+ "version": "0.0.21",
5
5
  "dependencies": {
6
6
  "@oclif/core": "^2.11.8",
7
7
  "@salesforce/core": "^5.2.0",