apex-code-coverage-transformer 2.1.0 → 2.2.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 +204 -0
- package/README.md +42 -14
- package/lib/commands/acc-transformer/transform.d.ts +2 -2
- package/lib/helpers/getPackageDirectories.js +4 -7
- package/lib/helpers/getPackageDirectories.js.map +1 -1
- package/lib/helpers/getRepoRoot.d.ts +4 -1
- package/lib/helpers/getRepoRoot.js +27 -8
- package/lib/helpers/getRepoRoot.js.map +1 -1
- package/lib/hooks/postrun.js +4 -1
- package/lib/hooks/postrun.js.map +1 -1
- package/oclif.lock +3899 -4288
- package/oclif.manifest.json +9 -1
- package/package.json +16 -15
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
<!-- markdownlint-disable MD024 MD025 -->
|
|
2
|
+
<!-- markdown-link-check-disable -->
|
|
3
|
+
|
|
4
|
+
# Changelog
|
|
5
|
+
|
|
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
|
+
|
|
8
|
+
## [2.2.1](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v2.2.0...v2.2.1) (2024-12-14)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* upgrade all dependencies ([7addc5d](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/7addc5dc6ec72f75a26bc1306ae42eee74daea25))
|
|
14
|
+
|
|
15
|
+
## [2.2.0](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v2.1.0...v2.2.0) (2024-10-28)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* remove dependency on git repos ([c2bc72d](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/c2bc72d72de00da8b52f3f1ae0a6b8805316b20f))
|
|
21
|
+
|
|
22
|
+
## [2.1.0](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v2.0.0...v2.1.0) (2024-10-22)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* remove command flag by adding type guard functions ([be380bf](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/be380bf2400cb217a3769d6272668d6ba277a6a4))
|
|
28
|
+
|
|
29
|
+
## [2.0.0](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.7.6...v2.0.0) (2024-10-21)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### ⚠ BREAKING CHANGES
|
|
33
|
+
|
|
34
|
+
* shorten command to acc-transformer
|
|
35
|
+
|
|
36
|
+
### Features
|
|
37
|
+
|
|
38
|
+
* shorten command to acc-transformer ([686cdc6](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/686cdc6960f8f73e7796e6b97928a8294a6b450b))
|
|
39
|
+
|
|
40
|
+
## [1.7.6](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.7.5...v1.7.6) (2024-07-28)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Bug Fixes
|
|
44
|
+
|
|
45
|
+
* refactor fs import ([d246c28](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/d246c28f70f5cd2ac40110b2d376ad0bac59384d))
|
|
46
|
+
|
|
47
|
+
## [1.7.5](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.7.4...v1.7.5) (2024-07-28)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
### Bug Fixes
|
|
51
|
+
|
|
52
|
+
* switch to isomorphic-git ([2da1fcc](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/2da1fcc2f55cf76296d1b7cd033daedba1bf496d))
|
|
53
|
+
|
|
54
|
+
## [1.7.4](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.7.3...v1.7.4) (2024-06-10)
|
|
55
|
+
|
|
56
|
+
### Bug Fixes
|
|
57
|
+
|
|
58
|
+
- include `apex get test` command in the hook ([34718f0](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/34718f0c146dbf51efe04c81d994c0c724e84a0c))
|
|
59
|
+
- update the hook to allow 2 different JSON paths based on command ([f6159be](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/f6159be3fe12801a00c06f44a5304cab2d02697e))
|
|
60
|
+
|
|
61
|
+
## [1.7.3](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.7.2...v1.7.3) (2024-05-15)
|
|
62
|
+
|
|
63
|
+
### Bug Fixes
|
|
64
|
+
|
|
65
|
+
- fix handling of an empty JSON from the test run command ([48ef6df](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/48ef6df77eda762006a78e1d2eb66936d57ee418))
|
|
66
|
+
- warn instead of fail when no files in the JSON are processed ([7809843](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/780984332c279ed7142695cbf262e67f69e916c0))
|
|
67
|
+
|
|
68
|
+
## [1.7.2](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.7.1...v1.7.2) (2024-05-10)
|
|
69
|
+
|
|
70
|
+
### Bug Fixes
|
|
71
|
+
|
|
72
|
+
- add support for coverage JSONs created by `sf apex run test` ([5f48b77](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/5f48b777f1ccd003d650c50ef87a0b24e2b4a73f))
|
|
73
|
+
|
|
74
|
+
## [1.7.2-beta.1](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.7.1...v1.7.2-beta.1) (2024-05-09)
|
|
75
|
+
|
|
76
|
+
### Bug Fixes
|
|
77
|
+
|
|
78
|
+
- add support for coverage JSONs created by `sf apex run test` ([5f48b77](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/5f48b777f1ccd003d650c50ef87a0b24e2b4a73f))
|
|
79
|
+
|
|
80
|
+
## [1.7.1](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.7.0...v1.7.1) (2024-04-30)
|
|
81
|
+
|
|
82
|
+
### Bug Fixes
|
|
83
|
+
|
|
84
|
+
- fix no-map replacement for windows-style paths ([e6d4fef](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/e6d4fef16266a8075c01601b3f5a838a058c5fa2))
|
|
85
|
+
|
|
86
|
+
# [1.7.0](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.6.8...v1.7.0) (2024-04-30)
|
|
87
|
+
|
|
88
|
+
### Features
|
|
89
|
+
|
|
90
|
+
- add a post run hook for post deployments ([894a4cd](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/894a4cdb14f6367b3e9248e757b1463e3134ae83))
|
|
91
|
+
|
|
92
|
+
## [1.6.8](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.6.7...v1.6.8) (2024-04-23)
|
|
93
|
+
|
|
94
|
+
### Bug Fixes
|
|
95
|
+
|
|
96
|
+
- get package directories and repo root before looping through files ([b630002](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/b6300020d650e02928c3b5700b05aa0c4bda050e))
|
|
97
|
+
|
|
98
|
+
## [1.6.7](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.6.6...v1.6.7) (2024-04-23)
|
|
99
|
+
|
|
100
|
+
### Bug Fixes
|
|
101
|
+
|
|
102
|
+
- remove `--sfdx-configuration` flag and get `sfdx-project.json` path using `simple-git` ([87d92f3](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/87d92f39fdd4f404887dc2c931940ea3221d7606))
|
|
103
|
+
|
|
104
|
+
## [1.6.6](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.6.5...v1.6.6) (2024-04-22)
|
|
105
|
+
|
|
106
|
+
### Bug Fixes
|
|
107
|
+
|
|
108
|
+
- fix path resolution when running in non-root directories ([c16fe7d](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/c16fe7d09898b857c68c2cc73a1ac2bcc8665f1e))
|
|
109
|
+
|
|
110
|
+
## [1.6.5](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.6.4...v1.6.5) (2024-04-18)
|
|
111
|
+
|
|
112
|
+
### Bug Fixes
|
|
113
|
+
|
|
114
|
+
- build XML using xmlbuilder2 and normalize path building using posix ([c6d6d94](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/c6d6d944e2675eb6be0dd90e972d67e6311f6738))
|
|
115
|
+
|
|
116
|
+
## [1.6.4](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.6.3...v1.6.4) (2024-04-09)
|
|
117
|
+
|
|
118
|
+
### Bug Fixes
|
|
119
|
+
|
|
120
|
+
- switch to promises/async and refactor imports ([2577692](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/2577692672aeb9271151f67e8347ef8a09a07b37))
|
|
121
|
+
|
|
122
|
+
## [1.6.3](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.6.2...v1.6.3) (2024-03-27)
|
|
123
|
+
|
|
124
|
+
### Bug Fixes
|
|
125
|
+
|
|
126
|
+
- remove flow logic ([dd3db2a](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/dd3db2ab60614dd21bdc844b78c8e882814c43a8))
|
|
127
|
+
|
|
128
|
+
## [1.6.2](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.6.1...v1.6.2) (2024-03-26)
|
|
129
|
+
|
|
130
|
+
### Bug Fixes
|
|
131
|
+
|
|
132
|
+
- warn if a file isn't found and fail if no files are found ([6b9e8ea](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/6b9e8ea80f9101429f82eed7fb3539c71dc613f4))
|
|
133
|
+
|
|
134
|
+
## [1.6.1](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.6.0...v1.6.1) (2024-03-22)
|
|
135
|
+
|
|
136
|
+
### Bug Fixes
|
|
137
|
+
|
|
138
|
+
- search the directories recursively without hard-coding the sub-folder names ([8880ab3](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/8880ab3e3c9097b8e7927230395eae32560ae55a))
|
|
139
|
+
|
|
140
|
+
## [1.6.1-beta.1](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.6.0...v1.6.1-beta.1) (2024-03-22)
|
|
141
|
+
|
|
142
|
+
### Bug Fixes
|
|
143
|
+
|
|
144
|
+
- search the directories recursively without hard-coding the sub-folder names ([8880ab3](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/8880ab3e3c9097b8e7927230395eae32560ae55a))
|
|
145
|
+
|
|
146
|
+
# [1.6.0](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.5.0...v1.6.0) (2024-03-21)
|
|
147
|
+
|
|
148
|
+
### Features
|
|
149
|
+
|
|
150
|
+
- add `covered` lines, renumbering out-of-range lines numbers ([1733b09](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/1733b09063eac28f0e627e66080dcd24d7c74bf9))
|
|
151
|
+
|
|
152
|
+
# [1.6.0-beta.1](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.5.0...v1.6.0-beta.1) (2024-03-20)
|
|
153
|
+
|
|
154
|
+
### Features
|
|
155
|
+
|
|
156
|
+
- add `covered` lines, renumbering out-of-range lines numbers ([1733b09](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/1733b09063eac28f0e627e66080dcd24d7c74bf9))
|
|
157
|
+
|
|
158
|
+
# [1.5.0](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.4.0...v1.5.0) (2024-03-20)
|
|
159
|
+
|
|
160
|
+
### Features
|
|
161
|
+
|
|
162
|
+
- support multiple package directories via the sfdx-project.json ([52c1a12](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/52c1a12ff5fbfb10c215a41e010ee7fc6c0370de))
|
|
163
|
+
|
|
164
|
+
# [1.4.0](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.3.1...v1.4.0) (2024-02-27)
|
|
165
|
+
|
|
166
|
+
### Features
|
|
167
|
+
|
|
168
|
+
- if coverage JSON includes file extensions, use that to determine paths ([efc1fa6](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/efc1fa61ce21cff394bbc696afce88c4d57894ea))
|
|
169
|
+
|
|
170
|
+
## [1.3.1](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.3.0...v1.3.1) (2024-02-26)
|
|
171
|
+
|
|
172
|
+
### Bug Fixes
|
|
173
|
+
|
|
174
|
+
- dx-directory should be an existing directory and fix flag in messages ([38fb20b](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/38fb20b8a107c203ba78266cb05d133805135ce4))
|
|
175
|
+
|
|
176
|
+
# [1.3.0](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.2.0...v1.3.0) (2024-02-07)
|
|
177
|
+
|
|
178
|
+
### Features
|
|
179
|
+
|
|
180
|
+
- add support for flows ([6bf0da1](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/6bf0da14a39871dc3b7d50565416c2d24fba7524))
|
|
181
|
+
|
|
182
|
+
# [1.2.0](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.1.1...v1.2.0) (2024-02-07)
|
|
183
|
+
|
|
184
|
+
### Features
|
|
185
|
+
|
|
186
|
+
- check if file name is an apex class or apex trigger using the dx directory flag ([215e41e](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/215e41eab0c41e2861d86370b0bddae2b2e487f0))
|
|
187
|
+
|
|
188
|
+
## [1.1.1](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.1.0...v1.1.1) (2024-02-07)
|
|
189
|
+
|
|
190
|
+
### Bug Fixes
|
|
191
|
+
|
|
192
|
+
- resolve path to xml ([cc75e96](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/cc75e96ef26120f86cff8588256e4f55e79d5473))
|
|
193
|
+
|
|
194
|
+
# [1.1.0](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v1.0.0...v1.1.0) (2024-02-07)
|
|
195
|
+
|
|
196
|
+
### Features
|
|
197
|
+
|
|
198
|
+
- update json flag name to ensure it's unique from the global flag and import path module ([d03c567](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/d03c567a7549e5ada291d82525c78e19a1b8fcba))
|
|
199
|
+
|
|
200
|
+
# 1.0.0 (2024-02-07)
|
|
201
|
+
|
|
202
|
+
### Features
|
|
203
|
+
|
|
204
|
+
- init release ([504b4cf](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/504b4cfb028fc14241b892e1cc872adadec736d7))
|
package/README.md
CHANGED
|
@@ -2,11 +2,39 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/apex-code-coverage-transformer) [](https://npmjs.org/package/apex-code-coverage-transformer) [](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/LICENSE.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<!-- TABLE OF CONTENTS -->
|
|
6
|
+
<details>
|
|
7
|
+
<summary>Table of Contents</summary>
|
|
8
|
+
|
|
9
|
+
- [Install](#install)
|
|
10
|
+
- [Who is the Plugin For?](#who-is-the-plugin-for)
|
|
11
|
+
- [Creating Code Coverage Files with the Salesforce CLI](#creating-code-coverage-files-with-the-salesforce-cli)
|
|
12
|
+
- [Command](#command)
|
|
13
|
+
- [`sf acc-transformer transform`](#sf-acc-transformer-transform)
|
|
14
|
+
- [Hook](#hook)
|
|
15
|
+
- [Errors and Warnings](#errors-and-warnings)
|
|
16
|
+
- [Example](#example)
|
|
17
|
+
- [Issues](#issues)
|
|
18
|
+
- [License](#license)
|
|
19
|
+
</details>
|
|
20
|
+
|
|
21
|
+
A Salesforce CLI plugin to transform the Apex code coverage JSON files created during deployments and test runs into the generic test coverage format (XML) accepted by SonarQube.
|
|
6
22
|
|
|
7
|
-
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
sf plugins install apex-code-coverage-transformer@x.y.z
|
|
27
|
+
```
|
|
8
28
|
|
|
9
|
-
|
|
29
|
+
## Who is the Plugin For?
|
|
30
|
+
|
|
31
|
+
This plugin is intended for users who deploy their Apex codebase (Apex classes and triggers) from any Salesforce DX repository (`sfdx-project.json` file), not just git-based ones. You should be running this plugin somewhere inside your Salesforce DX repository (root folder preferred). This plugin searches for your repository's `sfdx-project.json` file to know which package directories to search into. Since SonarQube relies on file-paths to map code coverage to the files in their explorer interface, the Apex files must be found in one of your package directories.
|
|
32
|
+
|
|
33
|
+
This plugin will work if you run local tests or run all tests in an org, including tests that originate from installed managed and unlocked packages. Since files from managed and unlocked packages aren't retrieved into Salesforce DX repositories, these files cannot be included in your SonarQube scans.
|
|
34
|
+
|
|
35
|
+
When the plugin is unable to find the Apex file from the coverage report in your repository, it will print a warning and not add that file's coverage data to the coverage XML created by this plugin. A warning will be printed for each file not found in a package directory in your repository. See [Errors and Warnings](https://github.com/mcarvin8/apex-code-coverage-transformer?tab=readme-ov-file#errors-and-warnings) for more information.
|
|
36
|
+
|
|
37
|
+
## Creating Code Coverage Files with the Salesforce CLI
|
|
10
38
|
|
|
11
39
|
To create the code coverage JSON during a Salesforce CLI deployment/validation, 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`.
|
|
12
40
|
|
|
@@ -14,31 +42,23 @@ To create the code coverage JSON during a Salesforce CLI deployment/validation,
|
|
|
14
42
|
sf project deploy [start/validate] --coverage-formatters json --results-dir "coverage"
|
|
15
43
|
```
|
|
16
44
|
|
|
17
|
-
To create the code coverage JSON when running tests directly in the org, append `--code-coverage --result-format json --output-dir "coverage"` to the `sf apex run test` or `sf apex get test` command. This will create the code coverage JSON in
|
|
45
|
+
To create the code coverage JSON when running tests directly in the org, append `--code-coverage --result-format json --output-dir "coverage"` to the `sf apex run test` or `sf apex get test` command. This will create the code coverage JSON in a folder named "coverage".
|
|
18
46
|
|
|
19
47
|
```
|
|
20
48
|
sf apex run test --code-coverage --result-format json --output-dir "coverage"
|
|
21
49
|
sf apex get test --test-run-id <test run id> --code-coverage --result-format json --output-dir "coverage"
|
|
22
50
|
```
|
|
23
51
|
|
|
24
|
-
The code coverage JSONs created by the Salesforce CLI aren't accepted by SonarQube automatically for
|
|
52
|
+
The code coverage JSONs created by the Salesforce CLI aren't accepted by SonarQube automatically for Salesforce DX repositories and needs to be converted using this plugin.
|
|
25
53
|
|
|
26
54
|
**Disclaimer**: Due to existing bugs with how the Salesforce CLI reports covered lines during deployments (see [5511](https://github.com/forcedotcom/salesforcedx-vscode/issues/5511) and [1568](https://github.com/forcedotcom/cli/issues/1568)), to add support for covered lines in this plugin for deployment coverage files, I had to add a function to re-number out-of-range covered lines the CLI may report (ex: line 100 in a 98-line Apex Class is reported back as covered by the Salesforce CLI deploy command). Salesforce's coverage result may also include extra lines as covered (ex: 120 lines are included in the coverage report for a 100 line file), so the coverage percentage may vary based on how many lines the API returns in the coverage report. Once Salesforce fixes the API to correctly return covered lines in the deploy command, this function will be removed.
|
|
27
55
|
|
|
28
|
-
## Install
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
sf plugins install apex-code-coverage-transformer@x.y.z
|
|
32
|
-
```
|
|
33
|
-
|
|
34
56
|
## Command
|
|
35
57
|
|
|
36
58
|
The `apex-code-coverage-transformer` has 1 command:
|
|
37
59
|
|
|
38
60
|
- `sf acc-transformer transform`
|
|
39
61
|
|
|
40
|
-
This command needs to be ran somewhere inside your Salesforce DX git repository, whether in the root folder (recommended) or in a subfolder. This plugin will determine the root folder of this repository and read the `sfdx-project.json` file in the root folder. All package directories listed in the `sfdx-project.json` file will be processed when running this plugin.
|
|
41
|
-
|
|
42
62
|
## `sf acc-transformer transform`
|
|
43
63
|
|
|
44
64
|
```
|
|
@@ -110,7 +130,7 @@ Error (1): The provided JSON does not match a known coverage data format from th
|
|
|
110
130
|
If the `sfdx-project.json` file was not found in your repository's root folder, the plugin will fail with:
|
|
111
131
|
|
|
112
132
|
```
|
|
113
|
-
Error (1):
|
|
133
|
+
Error (1): sfdx-project.json not found in any parent directory.
|
|
114
134
|
```
|
|
115
135
|
|
|
116
136
|
Any ENOENT failures indicate that the plugin had issues finding one of the package directories in the `sfdx-project.json` file:
|
|
@@ -194,3 +214,11 @@ This [code coverage JSON file](https://raw.githubusercontent.com/mcarvin8/apex-c
|
|
|
194
214
|
</file>
|
|
195
215
|
</coverage>
|
|
196
216
|
```
|
|
217
|
+
|
|
218
|
+
## Issues
|
|
219
|
+
|
|
220
|
+
If you encounter any issues, please create an issue in the repository's [issue tracker](https://github.com/mcarvin8/apex-code-coverage-transformer/issues). Please also create issues to suggest any new features.
|
|
221
|
+
|
|
222
|
+
## License
|
|
223
|
+
|
|
224
|
+
This project is licensed under the MIT license. Please see the [LICENSE](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/LICENSE.md) file for details.
|
|
@@ -5,8 +5,8 @@ export default class TransformerTransform extends SfCommand<TransformerTransform
|
|
|
5
5
|
static readonly description: string;
|
|
6
6
|
static readonly examples: string[];
|
|
7
7
|
static readonly flags: {
|
|
8
|
-
'coverage-json': import("@oclif/core/
|
|
9
|
-
xml: import("@oclif/core/
|
|
8
|
+
'coverage-json': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
xml: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
10
|
};
|
|
11
11
|
run(): Promise<TransformerTransformResult>;
|
|
12
12
|
}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
/* eslint-disable no-await-in-loop */
|
|
3
|
-
import { existsSync } from 'node:fs';
|
|
4
2
|
import { readFile } from 'node:fs/promises';
|
|
5
3
|
import { resolve } from 'node:path';
|
|
6
4
|
import { getRepoRoot } from './getRepoRoot.js';
|
|
7
5
|
export async function getPackageDirectories() {
|
|
8
|
-
const repoRoot = await getRepoRoot();
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
throw Error(`Salesforce DX Config File does not exist in this path: ${dxConfigPath}`);
|
|
6
|
+
const { repoRoot, dxConfigFilePath } = await getRepoRoot();
|
|
7
|
+
if (!repoRoot || !dxConfigFilePath) {
|
|
8
|
+
throw new Error('Failed to retrieve repository root or sfdx-project.json path.');
|
|
12
9
|
}
|
|
13
|
-
const sfdxProjectRaw = await readFile(
|
|
10
|
+
const sfdxProjectRaw = await readFile(dxConfigFilePath, 'utf-8');
|
|
14
11
|
const sfdxProject = JSON.parse(sfdxProjectRaw);
|
|
15
12
|
const packageDirectories = sfdxProject.packageDirectories.map((directory) => resolve(repoRoot, directory.path));
|
|
16
13
|
return { repoRoot, packageDirectories };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPackageDirectories.js","sourceRoot":"","sources":["../../src/helpers/getPackageDirectories.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"getPackageDirectories.js","sourceRoot":"","sources":["../../src/helpers/getPackageDirectories.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,CAAC,KAAK,UAAU,qBAAqB;IACzC,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAAG,MAAM,WAAW,EAAE,CAAC;IAE3D,IAAI,CAAC,QAAQ,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;IACnF,CAAC;IAED,MAAM,cAAc,GAAW,MAAM,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IACzE,MAAM,WAAW,GAAgB,IAAI,CAAC,KAAK,CAAC,cAAc,CAAgB,CAAC;IAC3E,MAAM,kBAAkB,GAAG,WAAW,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAChH,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -1,12 +1,31 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
import
|
|
2
|
+
/* eslint-disable no-await-in-loop */
|
|
3
|
+
import { access } from 'node:fs/promises';
|
|
4
|
+
import { join, dirname } from 'node:path';
|
|
4
5
|
export async function getRepoRoot() {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
let currentDir = process.cwd();
|
|
7
|
+
let found = false;
|
|
8
|
+
let dxConfigFilePath;
|
|
9
|
+
let repoRoot;
|
|
10
|
+
do {
|
|
11
|
+
const filePath = join(currentDir, 'sfdx-project.json');
|
|
12
|
+
try {
|
|
13
|
+
// Check if sfdx-project.json exists in the current directory
|
|
14
|
+
await access(filePath);
|
|
15
|
+
dxConfigFilePath = filePath;
|
|
16
|
+
repoRoot = currentDir;
|
|
17
|
+
found = true;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
// If file not found, move up one directory level
|
|
21
|
+
const parentDir = dirname(currentDir);
|
|
22
|
+
if (currentDir === parentDir) {
|
|
23
|
+
// Reached the root without finding the file, throw an error
|
|
24
|
+
throw new Error('sfdx-project.json not found in any parent directory.');
|
|
25
|
+
}
|
|
26
|
+
currentDir = parentDir;
|
|
27
|
+
}
|
|
28
|
+
} while (!found);
|
|
29
|
+
return { repoRoot, dxConfigFilePath };
|
|
11
30
|
}
|
|
12
31
|
//# sourceMappingURL=getRepoRoot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRepoRoot.js","sourceRoot":"","sources":["../../src/helpers/getRepoRoot.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"getRepoRoot.js","sourceRoot":"","sources":["../../src/helpers/getRepoRoot.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,qCAAqC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,WAAW;IAC/B,IAAI,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC/B,IAAI,KAAK,GAAG,KAAK,CAAC;IAClB,IAAI,gBAAoC,CAAC;IACzC,IAAI,QAA4B,CAAC;IAEjC,GAAG,CAAC;QACF,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,EAAE,mBAAmB,CAAC,CAAC;QAEvD,IAAI,CAAC;YACH,6DAA6D;YAC7D,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;YACvB,gBAAgB,GAAG,QAAQ,CAAC;YAC5B,QAAQ,GAAG,UAAU,CAAC;YACtB,KAAK,GAAG,IAAI,CAAC;QACf,CAAC;QAAC,MAAM,CAAC;YACP,iDAAiD;YACjD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;YACtC,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;gBAC7B,4DAA4D;gBAC5D,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;YAC1E,CAAC;YACD,UAAU,GAAG,SAAS,CAAC;QACzB,CAAC;IACH,CAAC,QAAQ,CAAC,KAAK,EAAE;IACjB,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC;AACxC,CAAC"}
|
package/lib/hooks/postrun.js
CHANGED
|
@@ -17,7 +17,10 @@ export const postrun = async function (options) {
|
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
let configFile;
|
|
20
|
-
const repoRoot = await getRepoRoot();
|
|
20
|
+
const { repoRoot } = await getRepoRoot();
|
|
21
|
+
if (!repoRoot) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
21
24
|
const configPath = resolve(repoRoot, '.apexcodecovtransformer.config.json');
|
|
22
25
|
try {
|
|
23
26
|
const jsonString = await readFile(configPath, 'utf-8');
|
package/lib/hooks/postrun.js.map
CHANGED
|
@@ -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,CAAC,CAAC,QAAQ,CAC5G,OAAO,CAAC,OAAO,CAAC,EAAE,CACnB,EACD,CAAC;QACD,WAAW,GAAG,QAAQ,CAAC;IACzB,CAAC;SAAM,IAAI,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;QAC3E,WAAW,GAAG,MAAM,CAAC;IACvB,CAAC;SAAM,CAAC;QACN,OAAO;IACT,CAAC;IACD,IAAI,UAAsB,CAAC;IAC3B,MAAM,QAAQ,GAAG,MAAM,WAAW,EAAE,CAAC;
|
|
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,CAAC,CAAC,QAAQ,CAC5G,OAAO,CAAC,OAAO,CAAC,EAAE,CACnB,EACD,CAAC;QACD,WAAW,GAAG,QAAQ,CAAC;IACzB,CAAC;SAAM,IAAI,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;QAC3E,WAAW,GAAG,MAAM,CAAC;IACvB,CAAC;SAAM,CAAC;QACN,OAAO;IACT,CAAC;IACD,IAAI,UAAsB,CAAC;IAC3B,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,WAAW,EAAE,CAAC;IACzC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO;IACT,CAAC;IACD,MAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,EAAE,qCAAqC,CAAC,CAAC;IAE5E,IAAI,CAAC;QACH,MAAM,UAAU,GAAW,MAAM,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAC/D,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAe,CAAC;IACpD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;IACT,CAAC;IAED,MAAM,WAAW,GAAW,UAAU,CAAC,eAAe,IAAI,cAAc,CAAC;IAEzE,IAAI,WAAW,KAAK,QAAQ,EAAE,CAAC;QAC7B,YAAY,GAAG,UAAU,CAAC,sBAAsB,IAAI,GAAG,CAAC;IAC1D,CAAC;SAAM,CAAC;QACN,YAAY,GAAG,UAAU,CAAC,oBAAoB,IAAI,GAAG,CAAC;IACxD,CAAC;IAED,IAAI,YAAY,CAAC,IAAI,EAAE,KAAK,GAAG,EAAE,CAAC;QAChC,OAAO;IACT,CAAC;IAED,MAAM,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/C,MAAM,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAE7C,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAClC,OAAO;IACT,CAAC;IAED,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,WAAW,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACpC,WAAW,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACnC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1B,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAClC,MAAM,oBAAoB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AAC9C,CAAC,CAAC"}
|