sf-delta-tests 0.0.24 → 0.0.26

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 CHANGED
@@ -1,146 +1,146 @@
1
- # sf-delta-tests
2
-
3
- [![NPM](https://img.shields.io/npm/v/focus-tests.svg?label=focus-tests)](https://www.npmjs.com/package/focus-tests) [![Downloads/week](https://img.shields.io/npm/dw/focus-tests.svg)](https://npmjs.org/package/focus-tests) [![License](https://img.shields.io/badge/License-BSD%203--Clause-brightgreen.svg)](https://raw.githubusercontent.com/salesforcecli/focus-tests/main/LICENSE.txt)
4
-
5
- ## Using the template
6
-
7
- This repository provides a template for creating a plugin for the Salesforce CLI. To convert this template to a working plugin:
8
-
9
- 1. Please get in touch with the Platform CLI team. We want to help you develop your plugin.
10
- 2. Generate your plugin:
11
-
12
- ```
13
- sf plugins install dev
14
- sf dev generate plugin
15
-
16
- git init -b main
17
- git add . && git commit -m "chore: initial commit"
18
- ```
19
-
20
- 3. Create your plugin's repo in the salesforcecli github org
21
- 4. When you're ready, replace the contents of this README with the information you want.
22
-
23
- ## Learn about `sf` plugins
24
-
25
- Salesforce CLI plugins are based on the [oclif plugin framework](<(https://oclif.io/docs/introduction.html)>). Read the [plugin developer guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_plugins.meta/sfdx_cli_plugins/cli_plugins_architecture_sf_cli.htm) to learn about Salesforce CLI plugin development.
26
-
27
- This repository contains a lot of additional scripts and tools to help with general Salesforce node development and enforce coding standards. You should familiarize yourself with some of the [node developer packages](#tooling) used by Salesforce.
28
-
29
- Additionally, there are some additional tests that the Salesforce CLI will enforce if this plugin is ever bundled with the CLI. These test are included by default under the `posttest` script and it is required to keep these tests active in your plugin if you plan to have it bundled.
30
-
31
- ### Tooling
32
-
33
- - [@salesforce/core](https://github.com/forcedotcom/sfdx-core)
34
- - [@salesforce/kit](https://github.com/forcedotcom/kit)
35
- - [@salesforce/sf-plugins-core](https://github.com/salesforcecli/sf-plugins-core)
36
- - [@salesforce/ts-types](https://github.com/forcedotcom/ts-types)
37
- - [@salesforce/ts-sinon](https://github.com/forcedotcom/ts-sinon)
38
- - [@salesforce/dev-config](https://github.com/forcedotcom/dev-config)
39
- - [@salesforce/dev-scripts](https://github.com/forcedotcom/dev-scripts)
40
-
41
- ### Hooks
42
-
43
- For cross clouds commands, e.g. `sf env list`, we utilize [oclif hooks](https://oclif.io/docs/hooks) to get the relevant information from installed plugins.
44
-
45
- This plugin includes sample hooks in the [src/hooks directory](src/hooks). You'll just need to add the appropriate logic. You can also delete any of the hooks if they aren't required for your plugin.
46
-
47
- # Everything past here is only a suggestion as to what should be in your specific plugin's description
48
-
49
- This plugin is bundled with the [Salesforce CLI](https://developer.salesforce.com/tools/sfdxcli). For more information on the CLI, read the [getting started guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_intro.htm).
50
-
51
- We always recommend using the latest version of these commands bundled with the CLI, however, you can install a specific version or tag if needed.
52
-
53
- ## Install
54
-
55
- ```bash
56
- sf plugins install focus-tests@x.y.z
57
- ```
58
-
59
- ## Issues
60
-
61
- Please report any issues at https://github.com/forcedotcom/cli/issues
62
-
63
- ## Contributing
64
-
65
- 1. Please read our [Code of Conduct](CODE_OF_CONDUCT.md)
66
- 2. Create a new issue before starting your project so that we can keep track of
67
- what you are trying to add/fix. That way, we can also offer suggestions or
68
- let you know if there is already an effort in progress.
69
- 3. Fork this repository.
70
- 4. [Build the plugin locally](#build)
71
- 5. Create a _topic_ branch in your fork. Note, this step is recommended but technically not required if contributing using a fork.
72
- 6. Edit the code in your fork.
73
- 7. Write appropriate tests for your changes. Try to achieve at least 95% code coverage on any new code. No pull request will be accepted without unit tests.
74
- 8. Sign CLA (see [CLA](#cla) below).
75
- 9. Send us a pull request when you are done. We'll review your code, suggest any needed changes, and merge it in.
76
-
77
- ### CLA
78
-
79
- External contributors will be required to sign a Contributor's License
80
- Agreement. You can do so by going to https://cla.salesforce.com/sign-cla.
81
-
82
- ### Build
83
-
84
- To build the plugin locally, make sure to have yarn installed and run the following commands:
85
-
86
- ```bash
87
- # Clone the repository
88
- git clone git@github.com:salesforcecli/focus-tests
89
-
90
- # Install the dependencies and compile
91
- yarn && yarn build
92
- ```
93
-
94
- To use your plugin, run using the local `./bin/dev` or `./bin/dev.cmd` file.
95
-
96
- ```bash
97
- # Run using local run file.
98
- ./bin/dev hello world
99
- ```
100
-
101
- There should be no differences when running via the Salesforce CLI or using the local run file. However, it can be useful to link the plugin to do some additional testing or run your commands from anywhere on your machine.
102
-
103
- ```bash
104
- # Link your plugin to the sf cli
105
- sf plugins link .
106
- # To verify
107
- sf plugins
108
- ```
109
-
110
- ## Commands
111
-
112
- <!-- commands -->
113
-
114
- - [`sf delta test-classes`](#sf-delta-test-classes)
115
-
116
- ## `sf delta test-classes`
117
-
118
- Calculates the tests needed to be ran based on the changed metadata given using the Salesforce Dependency API
119
-
120
- ```
121
- USAGE
122
- $ sf delta test-classes -o <value> -c <value> [--json] [-n <value>]
123
-
124
- FLAGS
125
- -c, --changed-metadata=<value> (required) Comma seperated list of changed metadata.
126
- -n, --name=<value> Description of a flag.
127
- -o, --target-org=<value> (required) The org you want to check the dependencies against.
128
-
129
- GLOBAL FLAGS
130
- --json Format output as json.
131
-
132
- DESCRIPTION
133
- Calculates the tests needed to be ran based on the changed metadata given using the Salesforce Dependency API
134
-
135
- Calculates the tests needed to be ran based on the changed metadata given using the Salesforce Dependency API
136
-
137
- EXAMPLES
138
- $ sf delta test-classes
139
-
140
- FLAG DESCRIPTIONS
141
- -n, --name=<value> Description of a flag.
142
-
143
- More information about a flag. Don't repeat the summary.
144
- ```
145
-
146
- <!-- commandsstop -->
1
+ # sf-delta-tests
2
+
3
+ [![NPM](https://img.shields.io/npm/v/focus-tests.svg?label=focus-tests)](https://www.npmjs.com/package/focus-tests) [![Downloads/week](https://img.shields.io/npm/dw/focus-tests.svg)](https://npmjs.org/package/focus-tests) [![License](https://img.shields.io/badge/License-BSD%203--Clause-brightgreen.svg)](https://raw.githubusercontent.com/salesforcecli/focus-tests/main/LICENSE.txt)
4
+
5
+ ## Using the template
6
+
7
+ This repository provides a template for creating a plugin for the Salesforce CLI. To convert this template to a working plugin:
8
+
9
+ 1. Please get in touch with the Platform CLI team. We want to help you develop your plugin.
10
+ 2. Generate your plugin:
11
+
12
+ ```
13
+ sf plugins install dev
14
+ sf dev generate plugin
15
+
16
+ git init -b main
17
+ git add . && git commit -m "chore: initial commit"
18
+ ```
19
+
20
+ 3. Create your plugin's repo in the salesforcecli github org
21
+ 4. When you're ready, replace the contents of this README with the information you want.
22
+
23
+ ## Learn about `sf` plugins
24
+
25
+ Salesforce CLI plugins are based on the [oclif plugin framework](<(https://oclif.io/docs/introduction.html)>). Read the [plugin developer guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_plugins.meta/sfdx_cli_plugins/cli_plugins_architecture_sf_cli.htm) to learn about Salesforce CLI plugin development.
26
+
27
+ This repository contains a lot of additional scripts and tools to help with general Salesforce node development and enforce coding standards. You should familiarize yourself with some of the [node developer packages](#tooling) used by Salesforce.
28
+
29
+ Additionally, there are some additional tests that the Salesforce CLI will enforce if this plugin is ever bundled with the CLI. These test are included by default under the `posttest` script and it is required to keep these tests active in your plugin if you plan to have it bundled.
30
+
31
+ ### Tooling
32
+
33
+ - [@salesforce/core](https://github.com/forcedotcom/sfdx-core)
34
+ - [@salesforce/kit](https://github.com/forcedotcom/kit)
35
+ - [@salesforce/sf-plugins-core](https://github.com/salesforcecli/sf-plugins-core)
36
+ - [@salesforce/ts-types](https://github.com/forcedotcom/ts-types)
37
+ - [@salesforce/ts-sinon](https://github.com/forcedotcom/ts-sinon)
38
+ - [@salesforce/dev-config](https://github.com/forcedotcom/dev-config)
39
+ - [@salesforce/dev-scripts](https://github.com/forcedotcom/dev-scripts)
40
+
41
+ ### Hooks
42
+
43
+ For cross clouds commands, e.g. `sf env list`, we utilize [oclif hooks](https://oclif.io/docs/hooks) to get the relevant information from installed plugins.
44
+
45
+ This plugin includes sample hooks in the [src/hooks directory](src/hooks). You'll just need to add the appropriate logic. You can also delete any of the hooks if they aren't required for your plugin.
46
+
47
+ # Everything past here is only a suggestion as to what should be in your specific plugin's description
48
+
49
+ This plugin is bundled with the [Salesforce CLI](https://developer.salesforce.com/tools/sfdxcli). For more information on the CLI, read the [getting started guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_intro.htm).
50
+
51
+ We always recommend using the latest version of these commands bundled with the CLI, however, you can install a specific version or tag if needed.
52
+
53
+ ## Install
54
+
55
+ ```bash
56
+ sf plugins install focus-tests@x.y.z
57
+ ```
58
+
59
+ ## Issues
60
+
61
+ Please report any issues at https://github.com/forcedotcom/cli/issues
62
+
63
+ ## Contributing
64
+
65
+ 1. Please read our [Code of Conduct](CODE_OF_CONDUCT.md)
66
+ 2. Create a new issue before starting your project so that we can keep track of
67
+ what you are trying to add/fix. That way, we can also offer suggestions or
68
+ let you know if there is already an effort in progress.
69
+ 3. Fork this repository.
70
+ 4. [Build the plugin locally](#build)
71
+ 5. Create a _topic_ branch in your fork. Note, this step is recommended but technically not required if contributing using a fork.
72
+ 6. Edit the code in your fork.
73
+ 7. Write appropriate tests for your changes. Try to achieve at least 95% code coverage on any new code. No pull request will be accepted without unit tests.
74
+ 8. Sign CLA (see [CLA](#cla) below).
75
+ 9. Send us a pull request when you are done. We'll review your code, suggest any needed changes, and merge it in.
76
+
77
+ ### CLA
78
+
79
+ External contributors will be required to sign a Contributor's License
80
+ Agreement. You can do so by going to https://cla.salesforce.com/sign-cla.
81
+
82
+ ### Build
83
+
84
+ To build the plugin locally, make sure to have yarn installed and run the following commands:
85
+
86
+ ```bash
87
+ # Clone the repository
88
+ git clone git@github.com:salesforcecli/focus-tests
89
+
90
+ # Install the dependencies and compile
91
+ yarn && yarn build
92
+ ```
93
+
94
+ To use your plugin, run using the local `./bin/dev` or `./bin/dev.cmd` file.
95
+
96
+ ```bash
97
+ # Run using local run file.
98
+ ./bin/dev hello world
99
+ ```
100
+
101
+ There should be no differences when running via the Salesforce CLI or using the local run file. However, it can be useful to link the plugin to do some additional testing or run your commands from anywhere on your machine.
102
+
103
+ ```bash
104
+ # Link your plugin to the sf cli
105
+ sf plugins link .
106
+ # To verify
107
+ sf plugins
108
+ ```
109
+
110
+ ## Commands
111
+
112
+ <!-- commands -->
113
+
114
+ - [`sf delta test-classes`](#sf-delta-test-classes)
115
+
116
+ ## `sf delta test-classes`
117
+
118
+ Calculates the tests needed to be ran based on the changed metadata given using the Salesforce Dependency API
119
+
120
+ ```
121
+ USAGE
122
+ $ sf delta test-classes -o <value> -c <value> [--json] [-n <value>]
123
+
124
+ FLAGS
125
+ -c, --changed-metadata=<value> (required) Comma seperated list of changed metadata.
126
+ -n, --name=<value> Description of a flag.
127
+ -o, --target-org=<value> (required) The org you want to check the dependencies against.
128
+
129
+ GLOBAL FLAGS
130
+ --json Format output as json.
131
+
132
+ DESCRIPTION
133
+ Calculates the tests needed to be ran based on the changed metadata given using the Salesforce Dependency API
134
+
135
+ Calculates the tests needed to be ran based on the changed metadata given using the Salesforce Dependency API
136
+
137
+ EXAMPLES
138
+ $ sf delta test-classes
139
+
140
+ FLAG DESCRIPTIONS
141
+ -n, --name=<value> Description of a flag.
142
+
143
+ More information about a flag. Don't repeat the summary.
144
+ ```
145
+
146
+ <!-- commandsstop -->
@@ -16,6 +16,7 @@ export default class TestClasses extends SfCommand<DeltaTestClassesResult> {
16
16
  static readonly flags: {
17
17
  'target-org': import("@oclif/core/lib/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
18
18
  'package-path': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
19
+ 'always-run-test': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
19
20
  };
20
21
  private dependencyService;
21
22
  private apexClassService;
@@ -38,10 +38,10 @@ class TestClasses extends sf_plugins_core_1.SfCommand {
38
38
  // If no meaningful changed metadata, no need to run tests (layout changes don't need tests!)
39
39
  if (changedMetadata.length === 0) {
40
40
  this.debug('No meaningful changed metadata, do not run any tests. (example, layout changes do not need tests ran)');
41
- this.log(this.cliService.noTests());
41
+ this.log(this.cliService.noTests(flags['always-run-test']));
42
42
  return {
43
43
  testNames: [],
44
- cli: this.cliService.noTests(),
44
+ cli: this.cliService.noTests(flags['always-run-test']),
45
45
  };
46
46
  }
47
47
  // Too many changes, just run all
@@ -59,13 +59,16 @@ class TestClasses extends sf_plugins_core_1.SfCommand {
59
59
  const testNames = await this.apexClassService.filterApexTest(classList);
60
60
  const simpleTestNames = this.apexClassService.filterApexTestSimple(classList);
61
61
  this.debug({ testNames, simpleTestNames });
62
+ if (flags['always-run-test']) {
63
+ testNames.push(...flags['always-run-test']);
64
+ }
62
65
  if (testNames.length === 0) {
63
66
  this.debug('No relevant tests found, skip running tests');
64
67
  // TODO: Debate this one, if we found no relevant tests, should all or none be ran?
65
- this.log(this.cliService.noTests());
68
+ this.log(this.cliService.noTests(flags['always-run-test']));
66
69
  return {
67
70
  testNames,
68
- cli: this.cliService.noTests(),
71
+ cli: this.cliService.noTests(flags['always-run-test']),
69
72
  };
70
73
  }
71
74
  this.debug(`Found meaningful and related tests: ${testNames.join(', ')}`);
@@ -95,11 +98,15 @@ TestClasses.flags = {
95
98
  char: 'o',
96
99
  required: true,
97
100
  }),
98
- 'package-path': sf_plugins_core_1.Flags.string({
101
+ 'package-path': sf_plugins_core_1.Flags.directory({
99
102
  summary: messages.getMessage('flags.package-path.summary'),
100
103
  char: 'p',
101
104
  default: 'manifest/package.xml',
102
105
  }),
106
+ 'always-run-test': sf_plugins_core_1.Flags.string({
107
+ summary: messages.getMessage('flags.always-run-test.summary'),
108
+ multiple: true,
109
+ }),
103
110
  };
104
111
  exports.default = TestClasses;
105
112
  //# sourceMappingURL=test-classes.js.map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AAI,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;aACzE;YAED,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;YACrC,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC;SAC3D;IACH,CAAC;;AAnIsB,mBAAO,GAAG,QAAQ,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;AAC/E,qGAAqG;AAC9E,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,SAAS,CAAC;QAC9B,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,4BAA4B,CAAC;QAC1D,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,sBAAsB;KAChC,CAAC;IACF,iBAAiB,EAAE,uBAAK,CAAC,MAAM,CAAC;QAC9B,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,+BAA+B,CAAC;QAC7D,QAAQ,EAAE,IAAI;KACf,CAAC;CACH,CAAC;kBAtBiB,WAAW"}
@@ -1,5 +1,5 @@
1
1
  export declare class CliService {
2
2
  specificTests(tests: string[]): string;
3
3
  allTests(): string;
4
- noTests(): string;
4
+ noTests(optionalTests?: string[]): string;
5
5
  }
@@ -10,8 +10,9 @@ class CliService {
10
10
  allTests() {
11
11
  return '--test-level=RunLocalTests';
12
12
  }
13
- noTests() {
14
- return '';
13
+ noTests(optionalTests) {
14
+ const testList = optionalTests?.map((test) => (test.includes(' ') ? `"${test}"` : test)) ?? [];
15
+ return `--test-level=RunSpecifiedTests --tests=SFDeltaTests-NoTest ${testList.join(' ')}`.trimEnd();
15
16
  }
16
17
  }
17
18
  exports.CliService = CliService;
@@ -1 +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,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAChF,OAAO,0CAA0C,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IACxE,CAAC;IAEM,QAAQ;QACb,OAAO,4BAA4B,CAAC;IACtC,CAAC;IAEM,OAAO;QACZ,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAbD,gCAaC"}
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,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAChF,OAAO,0CAA0C,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IACxE,CAAC;IAEM,QAAQ;QACb,OAAO,4BAA4B,CAAC;IACtC,CAAC;IAEM,OAAO,CAAC,aAAwB;QACrC,MAAM,QAAQ,GAAG,aAAa,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;QAC/F,OAAO,8DAA8D,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC;IACtG,CAAC;CACF;AAdD,gCAcC"}
@@ -8,8 +8,8 @@ Calculates the tests needed to be ran based on the changed metadata given using
8
8
 
9
9
  # examples
10
10
 
11
- tests=$(sf delta test-classes --target-org matt@never.io.dev)
12
- sf project deploy validate ${tests}
11
+ testCmd=$(sf delta test-classes --target-org matt@never.io.dev)
12
+ sf project deploy validate ${testCmd}
13
13
 
14
14
  # flags.target-org.summary
15
15
 
@@ -18,3 +18,7 @@ The org you want to check the dependencies against.
18
18
  # flags.package-path.summary
19
19
 
20
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,5 +1,5 @@
1
1
  {
2
- "version": "0.0.24",
2
+ "version": "0.0.26",
3
3
  "commands": {
4
4
  "delta:test-classes": {
5
5
  "id": "delta:test-classes",
@@ -11,7 +11,7 @@
11
11
  "pluginType": "core",
12
12
  "aliases": [],
13
13
  "examples": [
14
- "tests=$(sf delta test-classes --target-org matt@never.io.dev)\nsf project deploy validate ${tests}"
14
+ "testCmd=$(sf delta test-classes --target-org matt@never.io.dev)\nsf project deploy validate ${testCmd}"
15
15
  ],
16
16
  "flags": {
17
17
  "json": {
@@ -36,6 +36,12 @@
36
36
  "summary": "Path to the package.xml that will be deployed.",
37
37
  "multiple": false,
38
38
  "default": "manifest/package.xml"
39
+ },
40
+ "always-run-test": {
41
+ "name": "always-run-test",
42
+ "type": "option",
43
+ "summary": "A test class to run when no tests need to be ran.",
44
+ "multiple": true
39
45
  }
40
46
  },
41
47
  "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.24",
4
+ "version": "0.0.26",
5
5
  "dependencies": {
6
6
  "@oclif/core": "^2.11.8",
7
7
  "@salesforce/core": "^5.2.0",