diff --git a/README.md b/README.md
index d7ca004..28abda8 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ This will create a coverage JSON in this relative path - `coverage/coverage/cove
This JSON isn't accepted by SonarQube automatically and needs to be converted using this plugin.
-**Note**: This has been tested and confirmed on code which meets 100% coverage.
+**Disclaimer**: Due to existing bugs with how the Salesforce CLI reports `covered` lines (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, 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). Once Salesforce updates the API to correctly return `covered` lines in the deploy command, this function will be removed.
## Install
@@ -65,18 +65,99 @@ This [code coverage JSON file](https://raw.githubusercontent.com/mcarvin8/apex-c
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
```
diff --git a/force-app/main/default/classes/AccountProfile.cls b/test/baselines/classes/AccountProfile.cls
similarity index 100%
rename from force-app/main/default/classes/AccountProfile.cls
rename to test/baselines/classes/AccountProfile.cls
diff --git a/packaged/flows/Get_Info.flow-meta.xml b/test/baselines/flows/Get_Info.flow-meta.xml
similarity index 100%
rename from packaged/flows/Get_Info.flow-meta.xml
rename to test/baselines/flows/Get_Info.flow-meta.xml
diff --git a/force-app/main/default/triggers/AccountTrigger.trigger b/test/baselines/triggers/AccountTrigger.trigger
similarity index 100%
rename from force-app/main/default/triggers/AccountTrigger.trigger
rename to test/baselines/triggers/AccountTrigger.trigger
diff --git a/test/commands/transformer/unit.test.ts b/test/commands/transformer/unit.test.ts
index 27504c0..48c868b 100644
--- a/test/commands/transformer/unit.test.ts
+++ b/test/commands/transformer/unit.test.ts
@@ -10,11 +10,17 @@ import TransformerTransform from '../../../src/commands/apex-code-coverage/trans
describe('transform the code coverage json', () => {
const $$ = new TestContext();
let sfCommandStubs: ReturnType;
+ let baselineFlowPath = 'test/baselines/flows/Get_Info.flow-meta.xml';
+ let baselineClassPath = 'test/baselines/classes/AccountProfile.cls';
+ let baselineTriggerPath = 'test/baselines/triggers/AccountTrigger.trigger';
let coverageJsonPathNoExts = 'coverage_no_file_exts.json';
let coverageJsonPathWithExts = 'coverage_with_file_exts.json';
let testXmlPath1 = 'coverage1.xml';
let testXmlPath2 = 'coverage2.xml';
let sfdxConfigFile = 'sfdx-project.json';
+ baselineFlowPath = path.resolve(baselineFlowPath);
+ baselineClassPath = path.resolve(baselineClassPath);
+ baselineTriggerPath = path.resolve(baselineTriggerPath);
coverageJsonPathNoExts = path.resolve(coverageJsonPathNoExts);
coverageJsonPathWithExts = path.resolve(coverageJsonPathWithExts);
testXmlPath1 = path.resolve(testXmlPath1);
@@ -32,6 +38,12 @@ describe('transform the code coverage json', () => {
// Create mock files
before(() => {
+ fs.mkdirSync('force-app/main/default/classes', { recursive: true });
+ fs.mkdirSync('force-app/main/default/triggers', { recursive: true });
+ fs.mkdirSync('packaged/flows', { recursive: true });
+ fs.copyFileSync(baselineFlowPath, 'packaged/flows/Get_Info.flow-meta.xml');
+ fs.copyFileSync(baselineClassPath, 'force-app/main/default/classes/AccountProfile.cls');
+ fs.copyFileSync(baselineTriggerPath, 'force-app/main/default/triggers/AccountTrigger.trigger');
fs.writeFileSync(sfdxConfigFile, configJsonString);
});
@@ -45,6 +57,11 @@ describe('transform the code coverage json', () => {
// Cleanup mock files
after(() => {
+ fs.unlinkSync('force-app/main/default/classes/AccountProfile.cls');
+ fs.unlinkSync('force-app/main/default/triggers/AccountTrigger.trigger');
+ fs.unlinkSync('packaged/flows/Get_Info.flow-meta.xml');
+ fs.rmdirSync('force-app', { recursive: true });
+ fs.rmdirSync('packaged', { recursive: true });
fs.rmSync(testXmlPath1);
fs.rmSync(testXmlPath2);
fs.rmSync(sfdxConfigFile);