apex-code-coverage-transformer 2.10.0 → 2.11.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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,26 @@
5
5
 
6
6
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
7
7
 
8
+ ## [2.11.1](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v2.11.0...v2.11.1) (2025-03-25)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** bump @salesforce/core from 8.8.5 to 8.8.6 ([3cdbe52](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/3cdbe52bfee45d34d8d355f61451529f9fadaeb3))
14
+ * **deps:** bump @salesforce/sf-plugins-core from 12.2.0 to 12.2.1 ([60d3f72](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/60d3f72719fad96d46a55c02e616ab81e2f8d686))
15
+
16
+ ## [2.11.0](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v2.10.0...v2.11.0) (2025-03-07)
17
+
18
+
19
+ ### Features
20
+
21
+ * include ignore package directories flag in hook ([a7294a4](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/a7294a47a85141d4b1d0e21854ac14d4f19b9e14))
22
+
23
+
24
+ ### Bug Fixes
25
+
26
+ * **deps:** bump @salesforce/sf-plugins-core from 12.1.4 to 12.2.0 ([b96e83c](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/b96e83cc28c5f3ae82422c069fa157caa5e805b1))
27
+
8
28
  ## [2.10.0](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v2.9.0...v2.10.0) (2025-02-26)
9
29
 
10
30
 
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Apex Code Coverage Transformer
1
+ # `apex-code-coverage-transformer`
2
2
 
3
3
  [![NPM](https://img.shields.io/npm/v/apex-code-coverage-transformer.svg?label=apex-code-coverage-transformer)](https://www.npmjs.com/package/apex-code-coverage-transformer) [![Downloads/week](https://img.shields.io/npm/dw/apex-code-coverage-transformer.svg)](https://npmjs.org/package/apex-code-coverage-transformer) [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/LICENSE.md)
4
4
 
@@ -10,20 +10,20 @@
10
10
  - [Usage](#usage)
11
11
  - [Salesforce CLI](#salesforce-cli)
12
12
  - [SFDX Hardis](#sfdx-hardis)
13
- - [What This Fixes](#what-this-fixes)
13
+ - [Fixes and Enhancements](#fixes-and-enhancements)
14
14
  - [Command](#command)
15
15
  - [`sf acc-transformer transform`](#sf-acc-transformer-transform)
16
16
  - [Coverage Report Formats](#coverage-report-formats)
17
17
  - [Hook](#hook)
18
- - [Debugging](#debugging)
19
- - [Contributing](#contributing)
18
+ - [Troubleshooting](#troubleshooting)
20
19
  - [Issues](#issues)
20
+ - [Contributing](#contributing)
21
21
  - [License](#license)
22
22
  </details>
23
23
 
24
- A Salesforce CLI plugin to transform the Apex code coverage JSON files created during deployments and test runs into other [formats](#coverage-report-formats) accepted by SonarQube, GitHub, GitLab, Azure, Bitbucket, etc.
24
+ Transform the Salesforce Apex code coverage JSON files created during deployments and test runs into other [formats](#coverage-report-formats) accepted by SonarQube, GitHub, GitLab, Azure, Bitbucket, etc.
25
25
 
26
- If there's a coverage format not yet supported by this plugin, feel free to provide a pull request or issue for the coverage format.
26
+ > If there's a coverage format not yet supported by this plugin, feel free to provide a pull request or issue for the coverage format.
27
27
 
28
28
  ## Install
29
29
 
@@ -33,22 +33,20 @@ sf plugins install apex-code-coverage-transformer@x.y.z
33
33
 
34
34
  ## Usage
35
35
 
36
- This plugin is intended for users who deploy their Apex or invoke Apex tests in their orgs from any Salesforce DX project (`sfdx-project.json` file) and would like to import the code coverage reports into external tools. The code coverage reports created by the Salesforce CLI aren't accepted automatically by external tools and needs to be transformed using this plugin.
37
-
38
- This plugin will work regardless of your testing strategy (running all tests, running specified tests, running all local tests). The files in the original coverage JSON has to be found in one of the package directories to be added to the final report. This ensures external tools like SonarQube can match files in the coverage report to a file in the project.
36
+ This plugin is designed for users deploying Apex or running Apex tests within Salesforce DX projects (`sfdx-project.json`). It transforms Salesforce CLI JSON coverage reports into formats recognized by external tools.
39
37
 
40
- When the plugin is unable to find a matching Apex file in your project (i.e. Apex from managed and unlocked packages), it will print a warning and not add that file's coverage data to the final coverage report. See [Debugging](#debugging) for more information.
38
+ The plugin ensures that coverage data is only reported for files found in your package directories, preventing mismatches in tools like SonarQube. If Apex files are missing from your project (i.e. Apex from managed or unlocked packages), they will be excluded from the transformed report with a [warning](#troubleshooting).
41
39
 
42
- You should run this plugin after you deploy or invoke Apex tests in your org either using the Salesforce CLI or sfdx-hardis. See [Hook](#hook) if you'd like to automatically transform the coverage JSON after you run Salesforce CLI or sfdx-hardis commands.
40
+ To automate coverage transformation after deployments or test executions, see [Hook](#hook).
43
41
 
44
42
  ### Salesforce CLI
45
43
 
46
- **This plugin will only support the "json" coverage format from the Salesforce CLI. Do not use other coverage formats from the Salesforce CLI.**
44
+ > This plugin will only support the "json" coverage format from the Salesforce CLI. Do not use other coverage formats from the Salesforce CLI.
47
45
 
48
46
  To create the code coverage JSON when deploying or validating, append `--coverage-formatters json --results-dir "coverage"` to the `sf project deploy` command. This will create a coverage JSON in this relative path - `coverage/coverage/coverage.json`.
49
47
 
50
48
  ```
51
- sf project deploy [start/validate] --coverage-formatters json --results-dir "coverage"
49
+ sf project deploy [start/validate/report/resume] --coverage-formatters json --results-dir "coverage"
52
50
  ```
53
51
 
54
52
  To create the code coverage JSON when running tests directly in the org, append `--code-coverage --output-dir "coverage"` to the `sf apex run test` or `sf apex get test` command. This will create the code coverage JSON in this relative path - `coverage/test-result-codecoverage.json`
@@ -60,22 +58,24 @@ sf apex get test --test-run-id <test run id> --code-coverage --output-dir "cover
60
58
 
61
59
  ### SFDX Hardis
62
60
 
63
- This plugin can be used after running [sfdx-hardis](https://github.com/hardisgroupcom/sfdx-hardis) commands `hardis:project:deploy:smart` (only if `COVERAGE_FORMATTER_JSON=true` environment variable is defined) and `hardis:org:test:apex` assuming you have sfdx-hardis and this plugin installed.
61
+ This plugin can be used after running the below [sfdx-hardis](https://github.com/hardisgroupcom/sfdx-hardis) commands:
64
62
 
65
- Both hardis commands will create the code coverage JSON to transform here: `hardis-report/apex-coverage-results.json`. Provide this relative path as the `--coverage-json`/`-j` input for this plugin.
63
+ - `sf hardis project deploy smart` (only if `COVERAGE_FORMATTER_JSON=true` environment variable is defined)
64
+ - `sf hardis org test apex`
66
65
 
67
- ## What this fixes
66
+ Both hardis commands will create the code coverage JSON to transform here: `hardis-report/apex-coverage-results.json`.
68
67
 
69
- - The coverage reports created by this plugin will add correct file-paths per your Salesforce DX project. Salesforce CLI coverage reports have the `no-map/` prefix hard-coded into their coverage reports. The coverage report created in this plugin will only contain Apex coverage results against files found in your Salesforce DX project, allowing you to use these reports in external code quality tools like SonarQube.
70
- - Normalizes the coverage reports created by the Salesforce CLI deploy and test command. The coverage reports created by both CLI commands follow different formats and have different coverage format options. These differences cause issues when trying to have external tools like SonarQube parse the coverage reports. This plugin handles parsing both command coverage reports and converting them into common formats accepted by external tools like SonarQube and GitLab.
71
- - The coverage reports created by this plugin "fixes" an issue with Salesforce CLI deploy command coverage reports. The coverage reports created by the deploy command contains several inaccuracies in their covered lines.
72
- - Salesforce's deploy coverage report may report out-of-range lines as "covered", i.e. line 100 in a 98-line apex class is reported as "covered".
73
- - Salesforce's deploy coverage report may report extra lines than the total lines in the apex class, i.e. 120 lines are included in the deploy coverage report for a 100-line apex class.
74
- - The coverage percentage may vary based on how many lines the API returns in the original deploy coverage report.
75
- - To work around these inaccuracies, I added a re-numbering function which only runs against deploy coverage reports to ensure the transformed coverage reports are accepted by external tools.
76
- - Once the Salesforce server team fixes the API to correctly return coverage in deploy command coverage reports, I will remove this re-numbering function.
77
- - See issues [5511](https://github.com/forcedotcom/salesforcedx-vscode/issues/5511) and [1568](https://github.com/forcedotcom/cli/issues/1568).
78
- - **NOTE**: This does not affect coverage reports created by the Salesforce CLI test commands.
68
+ ## Fixes and Enhancements
69
+
70
+ - **Maps Apex file names** in the original coverage report (e.g., `no-map/AccountTriggerHandler`) to their corresponding relative file paths in the Salesforce DX project (e.g., `force-app/main/default/classes/AccountTriggerHandler.cls`).
71
+ - **Normalizes coverage reports** across both deploy and test commands, improving compatibility with external tools.
72
+ - **Adds additional coverage formats** not available in the default Salesforce CLI deploy and test commands.
73
+ - **"Fixes" inaccuracies** in Salesforce CLI deploy command coverage reports, such as out-of-range covered lines (e.g., line 100 reported as "covered" in a 98-line Apex class) and incorrect total line counts (e.g., 120 lines reported for a 100-line Apex class).
74
+ - To address these inaccuracies, the plugin includes a **re-numbering function** that only applies to deploy coverage reports. This function reassigns out-of-range `covered` lines to unused lines, ensuring reports are accepted by external tools.
75
+ - The `uncovered` lines are always correctly reported by the deploy command.
76
+ - Once Salesforce resolves the issue with the API that affects deploy command coverage reports, the re-numbering function will be removed in a future **breaking** release.
77
+ - See issues [5511](https://github.com/forcedotcom/salesforcedx-vscode/issues/5511) and [1568](https://github.com/forcedotcom/cli/issues/1568) for more details.
78
+ - **Note**: This does not affect coverage reports generated by the Salesforce CLI test commands.
79
79
 
80
80
  ## Command
81
81
 
@@ -87,7 +87,7 @@ The `apex-code-coverage-transformer` has 1 command:
87
87
 
88
88
  ```
89
89
  USAGE
90
- $ sf acc-transformer transform -j <value> -r <value> -f <value> -i <value> [--json]
90
+ $ sf acc-transformer transform -j <value> [-r <value>] [-f <value>] [-i <value>] [--json]
91
91
 
92
92
  FLAGS
93
93
  -j, --coverage-json=<value> Path to the code coverage JSON file created by the Salesforce CLI deploy or test command.
@@ -102,70 +102,76 @@ FLAGS
102
102
  GLOBAL FLAGS
103
103
  --json Format output as json.
104
104
 
105
- DESCRIPTION
106
- Transform the Apex code coverage JSON file created by the Salesforce CLI deploy and test command into other formats accepted by SonarQube, GitHub, GitLab, Azure, Bitbucket, etc.
107
-
108
105
  EXAMPLES
106
+ Transform the JSON into Sonar format:
107
+
109
108
  $ sf acc-transformer transform -j "coverage.json" -r "coverage.xml" -f "sonar"
110
109
 
110
+ Transform the JSON into Cobertura format:
111
+
111
112
  $ sf acc-transformer transform -j "coverage.json" -r "coverage.xml" -f "cobertura"
112
113
 
114
+ Transform the JSON into Clover format:
115
+
113
116
  $ sf acc-transformer transform -j "coverage.json" -r "coverage.xml" -f "clover"
114
117
 
118
+ Transform the JSON into LCovOnly format:
119
+
115
120
  $ sf acc-transformer transform -j "coverage.json" -r "coverage.info" -f "lcovonly"
116
121
 
122
+ Transform the JSON into Sonar format, ignoring Apex in the "force-app" directory:
123
+
117
124
  $ sf acc-transformer transform -j "coverage.json" -i "force-app"
118
125
  ```
119
126
 
120
127
  ## Coverage Report Formats
121
128
 
122
- The `-f`/`--format` flag allows you to specify the format of the coverage report.
129
+ The `-f`/`--format` flag allows you to specify the format of the transformed coverage report.
123
130
 
124
- | Flag Option | Description | Example |
125
- | ----------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
126
- | `sonar` | Generates a SonarQube-compatible coverage report. This is the default option. | [Sonar example](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/test/sonar_baseline.xml) |
127
- | `clover` | Produces a Clover XML report format, commonly used with Atlassian tools. | [Clover example](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/test/clover_baseline.xml) |
128
- | `lcovonly` | Outputs coverage data in LCOV format, useful for integrating with LCOV-based tools. | [LCovOnly example](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/test/lcov_baseline.info) |
129
- | `cobertura` | Creates a Cobertura XML report, a widely used format for coverage reporting. | [Cobertura example](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/test/cobertura_baseline.xml) |
130
- | `jacoco` | Creates a JaCoCo XML report, the standard for Java projects. | [JaCoCo example](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/test/jacoco_baseline.xml) |
131
+ | Flag Option | Description |
132
+ | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
133
+ | [sonar](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/test/sonar_baseline.xml) | Generates a SonarQube-compatible coverage report. This is the default option. |
134
+ | [clover](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/test/clover_baseline.xml) | Produces a Clover XML report format, commonly used with Atlassian tools. |
135
+ | [lcovonly](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/test/lcov_baseline.info) | Outputs coverage data in LCOV format, useful for integrating with LCOV-based tools. |
136
+ | [cobertura](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/test/cobertura_baseline.xml) | Creates a Cobertura XML report, a widely used format for coverage reporting. |
137
+ | [jacoco](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/test/jacoco_baseline.xml) | Creates a JaCoCo XML report, the standard for Java projects. |
131
138
 
132
139
  ## Hook
133
140
 
134
- A post-run hook has been configured if you opt into using it by creating a `.apexcodecovtransformer.config.json` config file in the root of your repo. If the config file is found, the post-run hook will automatically run after the following commands:
141
+ To enable automatic transformation after the below `sf` commands complete, create a `.apexcodecovtransformer.config.json` in your project’s root directory.
135
142
 
136
- - `sf project deploy start`
137
- - `sf project deploy validate`
138
- - `sf project deploy report`
139
- - `sf project deploy resume`
143
+ - `sf project deploy [start/validate/report/resume]`
140
144
  - `sf apex run test`
141
145
  - `sf apex get test`
142
- - `sf hardis project deploy smart` (only if sfdx-hardis is installed and `COVERAGE_FORMATTER_JSON=true` environment variable is defined)
143
- - `sf hardis org test apex` (only if sfdx-hardis is installed)
144
-
145
- You can copy the sample [Salesforce CLI .apexcodecovtransformer.config.json](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/defaults/salesforce-cli/.apexcodecovtransformer.config.json), which assumes you are running the Salesforce CLI commands and specifying the `--results-dir`/`--output-dir` directory as "coverage". Update this sample with your desired output report path and format.
146
+ - `sf hardis project deploy smart`
147
+ - only if `sfdx-hardis` is installed
148
+ - `COVERAGE_FORMATTER_JSON=true` must be set in the environment variables
149
+ - `sf hardis org test apex`
150
+ - only if `sfdx-hardis` is installed
146
151
 
147
- You can copy the sample [SFDX Hardis .apexcodecovtransformer.config.json](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/defaults/sfdx-hardis/.apexcodecovtransformer.config.json), which assumes you are running the SFDX Hardis commands. Update this sample with your desired output report path and format.
152
+ You can copy & update the sample [Salesforce CLI .apexcodecovtransformer.config.json](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/defaults/salesforce-cli/.apexcodecovtransformer.config.json), which assumes you are running the Salesforce CLI commands and specifying the `--results-dir`/`--output-dir` directory as "coverage".
148
153
 
149
- The `.apexcodecovtransformer.config.json` follows this structure:
154
+ You can copy & update the sample [SFDX Hardis .apexcodecovtransformer.config.json](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/defaults/sfdx-hardis/.apexcodecovtransformer.config.json), which assumes you are running the SFDX Hardis commands.
150
155
 
151
- - `deployCoverageJsonPath` is required to use the hook after deploy commands and should be the path to the code coverage JSON created by the Salesforce CLI/SFDX Hardis deploy command. Recommend using a relative path.
152
- - `testCoverageJsonPath` is required to use the hook after test commands and should be the path to the code coverage JSON created by the Salesforce CLI/SFDX Hardis test command. Recommend using a relative path.
153
- - `outputReportPath` is optional and should be the path to the code coverage file created by this plugin. Recommend using a relative path. If this isn't provided, it will default to `coverage.[xml/info]` in the working directory.
154
- - `format` is optional and should be the intended coverage report format created by this plugin. If this isn't provided, it will default to "sonar".
156
+ **`.apexcodecovtransformer.config.json` structure**
155
157
 
156
- If the `.apexcodecovtransformer.config.json` file isn't found, the hook will be skipped.
158
+ | JSON Key | Required | Description |
159
+ | -------------------------- | -------------------------------------- | --------------------------------------------------------------------------------------------- |
160
+ | `deployCoverageJsonPath` | Yes (for deploy command) | Code coverage JSON created by the Salesforce CLI deploy commands. |
161
+ | `testCoverageJsonPath` | Yes (for test command) | Code coverage JSON created by the Salesforce CLI test commands. |
162
+ | `outputReportPath` | No (defaults to `coverage.[xml/info]`) | Transformed code coverage report path. |
163
+ | `format` | No (defaults to `sonar`) | Transformed code coverage report [format](#coverage-report-formats). |
164
+ | `ignorePackageDirectories` | No | Comma-separated string of package directories to ignore when looking for matching Apex files. |
157
165
 
158
- ## Debugging
166
+ ## Troubleshooting
159
167
 
160
- Any file in the coverage JSON that isn't found in any package directory will result in this warning:
168
+ If a file listed in the coverage JSON cannot be found in any package directory, a warning is displayed, and the file will not be included in the transformed report:
161
169
 
162
170
  ```
163
171
  Warning: The file name AccountTrigger was not found in any package directory.
164
172
  ```
165
173
 
166
- Files not found in any package directory will not be added to the output coverage report. This includes Apex classes that originate from installed managed and unlocked packages when running all tests in your org.
167
-
168
- If none of the files listed in the coverage JSON were found in a package directory, the plugin will print an additional warning stating no files were processed. In this case, the output coverage report generated will be an empty file.
174
+ If **none** of the files in the coverage JSON are found in a package directory, the plugin will print an additional warning, and the generated report will be empty:
169
175
 
170
176
  ```
171
177
  Warning: The file name AccountTrigger was not found in any package directory.
@@ -173,31 +179,31 @@ Warning: The file name AccountProfile was not found in any package directory.
173
179
  Warning: None of the files listed in the coverage JSON were processed. The coverage report will be empty.
174
180
  ```
175
181
 
176
- The code coverage JSON files created by the Salesforce CLI deploy and test commands follow different formats. If the code coverage JSON file provided does not match 1 of the 2 expected coverage data types, the plugin will fail with:
182
+ Salesforce CLI generates code coverage JSONs in two different structures (deploy and test command formats). If the provided coverage JSON does not match one of these expected structures, the plugin will fail with:
177
183
 
178
184
  ```
179
185
  Error (1): The provided JSON does not match a known coverage data format from the Salesforce deploy or test command.
180
186
  ```
181
187
 
182
- If the `sfdx-project.json` file was not found in your project's root folder, the plugin will fail with:
188
+ If `sfdx-project.json` file is missing from the project root, the plugin will fail with:
183
189
 
184
190
  ```
185
191
  Error (1): sfdx-project.json not found in any parent directory.
186
192
  ```
187
193
 
188
- Any ENOENT failures indicate that the plugin had issues finding one of the package directories in the `sfdx-project.json` file:
194
+ If a package directory listed in `sfdx-project.json` cannot be found, the plugin will encounter a **ENOENT** error:
189
195
 
190
196
  ```
191
- Error (1): ENOENT: no such file or directory: {packageDirPath}
197
+ Error (1): ENOENT: no such file or directory: {packageDir}
192
198
  ```
193
199
 
194
- ## Contributing
200
+ ## Issues
195
201
 
196
- Contributions are welcome! See [Contributing](https://github.com/mcarvin8/apex-code-coverage-transformer/blob/main/CONTRIBUTING.md).
202
+ If you encounter any issues or would like to suggest features, please create an [issue](https://github.com/mcarvin8/apex-code-coverage-transformer/issues).
197
203
 
198
- ## Issues
204
+ ## Contributing
199
205
 
200
- If you encounter any issues, please create an issue in the [issue tracker](https://github.com/mcarvin8/apex-code-coverage-transformer/issues). Please also create issues to suggest any new features.
206
+ Contributions are welcome! See [Contributing](https://github.com/mcarvin8/apex-code-coverage-transformer/blob/main/CONTRIBUTING.md).
201
207
 
202
208
  ## License
203
209
 
@@ -53,6 +53,7 @@ export type HookFile = {
53
53
  testCoverageJsonPath: string;
54
54
  outputReportPath: string;
55
55
  format: string;
56
+ ignorePackageDirectories: string;
56
57
  };
57
58
  export type CoberturaLine = {
58
59
  '@number': number;
@@ -7,7 +7,13 @@ import { getRepoRoot } from '../helpers/getRepoRoot.js';
7
7
  export const postrun = async function (options) {
8
8
  let commandType;
9
9
  let coverageJson;
10
- if (['project:deploy:validate', 'project:deploy:start', 'project:deploy:report', 'project:deploy:resume', 'hardis:project:deploy:smart'].includes(options.Command.id)) {
10
+ if ([
11
+ 'project:deploy:validate',
12
+ 'project:deploy:start',
13
+ 'project:deploy:report',
14
+ 'project:deploy:resume',
15
+ 'hardis:project:deploy:smart',
16
+ ].includes(options.Command.id)) {
11
17
  commandType = 'deploy';
12
18
  }
13
19
  else if (['apex:run:test', 'apex:get:test', 'hardis:org:test:apex'].includes(options.Command.id)) {
@@ -31,6 +37,7 @@ export const postrun = async function (options) {
31
37
  }
32
38
  const outputReport = configFile.outputReportPath || 'coverage.xml';
33
39
  const coverageFormat = configFile.format || 'sonar';
40
+ const ignorePackageDirs = configFile.ignorePackageDirectories || '';
34
41
  if (commandType === 'deploy') {
35
42
  coverageJson = configFile.deployCoverageJsonPath || '.';
36
43
  }
@@ -52,6 +59,14 @@ export const postrun = async function (options) {
52
59
  commandArgs.push(outputReportPath);
53
60
  commandArgs.push('--format');
54
61
  commandArgs.push(coverageFormat);
62
+ if (ignorePackageDirs.trim() !== '') {
63
+ const ignorePackageDirArray = ignorePackageDirs.split(',');
64
+ for (const dirs of ignorePackageDirArray) {
65
+ const sanitizedDir = dirs.replace(/,/g, '');
66
+ commandArgs.push('--ignore-package-directory');
67
+ commandArgs.push(sanitizedDir);
68
+ }
69
+ }
55
70
  await TransformerTransform.run(commandArgs);
56
71
  };
57
72
  //# sourceMappingURL=postrun.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"postrun.js","sourceRoot":"","sources":["../../src/hooks/postrun.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,oBAAoB,MAAM,0CAA0C,CAAC;AAE5E,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,CAAC,MAAM,OAAO,GAAoB,KAAK,WAAW,OAAO;IAC7D,IAAI,WAAmB,CAAC;IACxB,IAAI,YAAoB,CAAC;IACzB,IACE,CAAC,yBAAyB,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,6BAA6B,CAAC,CAAC,QAAQ,CAC3I,OAAO,CAAC,OAAO,CAAC,EAAE,CACnB,EACD,CAAC;QACD,WAAW,GAAG,QAAQ,CAAC;IACzB,CAAC;SAAM,IAAI,CAAC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