apex-code-coverage-transformer 3.1.11 → 4.0.0

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,27 @@
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
+ ## [4.0.0](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v3.1.12...v4.0.0) (2026-11-05)
9
+
10
+
11
+ ### ⚠ BREAKING CHANGES
12
+
13
+ * remove deploy coverage line renumbering ([#429](https://github.com/mcarvin8/apex-code-coverage-transformer/issues/429))
14
+
15
+ ### Features
16
+
17
+ * remove deploy coverage line renumbering ([#429](https://github.com/mcarvin8/apex-code-coverage-transformer/issues/429)) ([0c15717](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/0c157176edb7a9e0513f8558960f47bd97558a4a))
18
+
19
+ ## [3.1.12](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v3.1.11...v3.1.12) (2026-10-28)
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * **deps:** bump fast-uri from 3.1.8 to 3.1.9 ([#423](https://github.com/mcarvin8/apex-code-coverage-transformer/issues/423)) ([dd33d19](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/dd33d19875f5965a261f1275d5b29525e2b0ad60))
25
+ * **deps:** bump qs from 6.15.3 to 6.17.0 ([#420](https://github.com/mcarvin8/apex-code-coverage-transformer/issues/420)) ([9d5eaee](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/9d5eaee4b2de35048074d73198bd71a0f736609d))
26
+ * **deps:** bump undici ([#421](https://github.com/mcarvin8/apex-code-coverage-transformer/issues/421)) ([1d78985](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/1d789851876821f9f595e24dd2ed3c143f7f4889))
27
+ * **deps:** bump zod from 4.4.3 to 4.6.7 ([#424](https://github.com/mcarvin8/apex-code-coverage-transformer/issues/424)) ([649c403](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/649c4039795b4551e7445a42c06e8d34f9dccae7))
28
+
8
29
  ## [3.1.11](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v3.1.10...v3.1.11) (2026-10-12)
9
30
 
10
31
 
package/README.md CHANGED
@@ -6,11 +6,13 @@
6
6
  [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/LICENSE.md)
7
7
  [![codecov](https://codecov.io/gh/mcarvin8/apex-code-coverage-transformer/graph/badge.svg?token=4IQ4NWTPQZ)](https://codecov.io/gh/mcarvin8/apex-code-coverage-transformer)
8
8
  [![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fmcarvin8%2Fapex-code-coverage-transformer%2Fmain)](https://dashboard.stryker-mutator.io/reports/github.com/mcarvin8/apex-code-coverage-transformer/main)
9
+ <!-- gh-dependents-info-used-by-start -->
10
+ [![Generated by github-dependents-info](https://img.shields.io/static/v1?label=Used%20by&message=2&color=informational&logo=slickpic)](https://github.com/mcarvin8/apex-code-coverage-transformer/blob/main/docs/github-dependents-info.md)<!-- gh-dependents-info-used-by-end -->
9
11
 
10
12
  Transforms (and optionally merges) Apex code coverage JSON from Salesforce deployments or test runs into formats used by SonarQube, Codecov, GitHub, GitLab, Azure DevOps, Bitbucket, and other tools, keeping coverage visible across pull requests, CI/CD pipelines, and code quality platforms. Available as a **Salesforce CLI plugin** for any provider, and as a **native GitHub Action** for GitHub Actions users who want to skip installing the CLI.
11
13
 
12
14
  > [!WARNING]
13
- > **Note:** Salesforce deploy command coverage reports contain a known bug where covered lines can be reported beyond the end of a file. This plugin automatically re-numbers those lines to keep deploy coverage accurate. Salesforce API v68.0 is expected to resolve the bug; the fix is kept in place for API v67.0 and earlier. Test-command coverage is unaffected. See [Troubleshooting](#troubleshooting) for details.
15
+ > **v4 breaking change:** v3 and earlier automatically re-numbered deploy command coverage lines that Salesforce reported beyond the end of a file. Salesforce fixed this bug server-side in Winter '27 (API v68.0), regardless of the `--api-version` used on the deploy, so v4 removes the re-numbering and passes deploy coverage lines through exactly as reported. Test-command coverage is unaffected. See [Troubleshooting](#troubleshooting) for details.
14
16
 
15
17
  <details>
16
18
  <summary>Table of Contents</summary>
@@ -66,19 +68,18 @@ It still needs the checkout to contain `sfdx-project.json` (same as the CLI's [P
66
68
 
67
69
  ```bash
68
70
  sf apex run test --code-coverage --output-dir "coverage"
71
+ # Creates code coverage file here: coverage/test-result-codecoverage.json
69
72
  ```
70
73
 
71
74
  From deploy/validate:
72
75
 
73
76
  ```bash
74
77
  sf project deploy start --coverage-formatters json --results-dir "coverage"
75
- # or: sf project deploy validate --coverage-formatters json --results-dir "coverage"
78
+ # Creates code coverage file here: coverage/coverage/coverage.json
76
79
  ```
77
80
 
78
81
  2. **Transform to your target format**
79
82
 
80
- Test output → `coverage/test-result-codecoverage.json`. Deploy output → `coverage/coverage/coverage.json`.
81
-
82
83
  ```bash
83
84
  # SonarQube
84
85
  sf acc-transformer transform -j "coverage/test-result-codecoverage.json" -r "coverage.xml" -f "sonar"
@@ -129,6 +130,7 @@ Works with [sfdx-hardis](https://github.com/hardisgroupcom/sfdx-hardis):
129
130
 
130
131
  ## Command Reference
131
132
 
133
+ <!-- biome-ignore format: oclif readme writes this list with `*` bullets -->
132
134
  <!-- commands -->
133
135
  * [`sf acc-transformer transform`](#sf-acc-transformer-transform)
134
136
 
@@ -195,7 +197,7 @@ EXAMPLES
195
197
  `sf acc-transformer transform -j "coverage1.json" -j "coverage2.json" -r "coverage.xml" -f "sonar"`
196
198
  ```
197
199
 
198
- _See code: [src/commands/acc-transformer/transform.ts](https://github.com/mcarvin8/apex-code-coverage-transformer/blob/v3.1.11/src/commands/acc-transformer/transform.ts)_
200
+ _See code: [src/commands/acc-transformer/transform.ts](https://github.com/mcarvin8/apex-code-coverage-transformer/blob/v4.0.0/src/commands/acc-transformer/transform.ts)_
199
201
  <!-- commandsstop -->
200
202
 
201
203
  ## Coverage Report Formats
@@ -203,7 +205,7 @@ _See code: [src/commands/acc-transformer/transform.ts](https://github.com/mcarvi
203
205
  Use `-f` / `--format` to choose the output format. Multiple `-f` values produce multiple files with the format in the name (e.g. `coverage-sonar.xml`, `coverage-cobertura.xml`).
204
206
 
205
207
  | Format | Description | Typical use | Example |
206
- |----------------|----------------------------|-----------------------------------------|-----------------------------------------------------------------------------------------|
208
+ | -------------- | -------------------------- | --------------------------------------- | --------------------------------------------------------------------------------------- |
207
209
  | sonar | SonarQube generic coverage | SonarQube, SonarCloud | `sf acc-transformer transform -j "coverage.json" -r "coverage.xml" -f "sonar"` |
208
210
  | cobertura | Cobertura XML | Codecov, Azure, Jenkins, GitLab, GitHub | `sf acc-transformer transform -j "coverage.json" -r "coverage.xml" -f "cobertura"` |
209
211
  | jacoco | JaCoCo XML | Codecov, Jenkins, Maven, Gradle | `sf acc-transformer transform -j "coverage.json" -r "coverage.xml" -f "jacoco"` |
@@ -236,7 +238,7 @@ jobs:
236
238
  - name: Set up Node.js
237
239
  uses: actions/setup-node@v4
238
240
  with:
239
- node-version: '20'
241
+ node-version: "20"
240
242
 
241
243
  - name: Install Salesforce CLI
242
244
  run: npm install -g @salesforce/cli@latest
@@ -408,7 +410,7 @@ jobs:
408
410
  fetch-depth: 0
409
411
  - uses: actions/setup-node@v4
410
412
  with:
411
- node-version: '20'
413
+ node-version: "20"
412
414
  - run: npm install -g @salesforce/cli@latest
413
415
  - run: echo y | sf plugins install apex-code-coverage-transformer
414
416
  - name: Download Suite A coverage
@@ -492,7 +494,7 @@ pool:
492
494
  steps:
493
495
  - task: NodeTool@0
494
496
  inputs:
495
- versionSpec: '20.x'
497
+ versionSpec: "20.x"
496
498
  displayName: Set up Node.js
497
499
 
498
500
  - script: npm install -g @salesforce/cli@latest
@@ -534,7 +536,7 @@ Create `.apexcodecovtransformer.config.json` in the project root to transform co
534
536
  Sample configs: [Salesforce CLI](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/defaults/salesforce-cli/.apexcodecovtransformer.config.json), [SFDX Hardis](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/defaults/sfdx-hardis/.apexcodecovtransformer.config.json).
535
537
 
536
538
  | Key | Required | Description |
537
- |----------------------------|------------|----------------------------------------------------------------------------------------------------------------------------------------------|
539
+ | -------------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
538
540
  | `deployCoverageJsonPath` | For deploy | Path to deploy coverage JSON. |
539
541
  | `testCoverageJsonPath` | For test | Path to test coverage JSON. |
540
542
  | `outputReportPath` | No | Output path (default: `coverage.[xml/info/json]` by format). |
@@ -590,17 +592,7 @@ Error (1): sfdx-project.json not found in any parent directory.
590
592
  Error (1): ENOENT: no such file or directory: {packageDir}
591
593
  ```
592
594
 
593
- **Deploy coverage line numbers** — Salesforce deploy command coverage reports contain known out-of-range line numbers, regardless of the coverage format requested from the Salesforce CLI. This plugin corrects them automatically by re-numbering covered lines; uncovered lines are unaffected. Test-command coverage is unaffected. See [forcedotcom/salesforcedx-vscode#5511](https://github.com/forcedotcom/salesforcedx-vscode/issues/5511) and [forcedotcom/cli#1568](https://github.com/forcedotcom/cli/issues/1568).
594
-
595
- Salesforce API v68.0 is expected to resolve the out-of-range line numbers in deploy coverage. The re-numbering logic is kept intact for compatibility with API v67.0 and earlier. It only acts on covered lines beyond the end of a file, so when deploy coverage contains no out-of-range lines, it makes no changes.
596
-
597
- To see each remapping, set `SF_LOG_LEVEL=debug` before running the command - each remapped line prints directly to the terminal:
598
-
599
- ```bash
600
- $ SF_LOG_LEVEL=debug sf acc-transformer transform -j "coverage/coverage/coverage.json" -r "coverage.xml" -f "sonar"
601
- [DEBUG] setCoveredLines: Remapping out-of-range covered line 512 to line 47 in force-app/main/default/classes/AccountHandler.cls (file has 98 lines)
602
- The coverage report has been written to: coverage.xml
603
- ```
595
+ **Deploy coverage line numbers** — Older Salesforce deploy command coverage reports could contain covered lines numbered past the end of a file ([forcedotcom/salesforcedx-vscode#5511](https://github.com/forcedotcom/salesforcedx-vscode/issues/5511), [forcedotcom/cli#1568](https://github.com/forcedotcom/cli/issues/1568)). Salesforce fixed this server-side in Winter '27 (API v68.0), and the fix applies regardless of the `--api-version` requested on the deploy. Versions 3.x and earlier of this plugin re-numbered those lines; starting with v4, deploy coverage lines are passed through as reported by Salesforce. If you still see out-of-range lines in deploy coverage, please [open an issue](https://github.com/mcarvin8/apex-code-coverage-transformer/issues/2).
604
596
 
605
597
  ## Questions or Issues?
606
598
 
@@ -6,7 +6,6 @@ import { getCoverageHandler } from '../handlers/getHandler.js';
6
6
  import { findFilePath } from '../utils/findFilePath.js';
7
7
  import { matchesGlob } from '../utils/globMatcher.js';
8
8
  import { mapLimit } from '../utils/mapLimit.js';
9
- import { setCoveredLines } from '../utils/setCoveredLines.js';
10
9
  export function createHandlers(formats) {
11
10
  const handlers = new Map();
12
11
  for (const format of formats) {
@@ -14,9 +13,6 @@ export function createHandlers(formats) {
14
13
  }
15
14
  return handlers;
16
15
  }
17
- function hasSourceContent(result) {
18
- return typeof result === 'object' && result !== null && 'sourceContent' in result;
19
- }
20
16
  async function readSourceFile(absolutePath) {
21
17
  try {
22
18
  return await readFile(absolutePath, 'utf-8');
@@ -25,6 +21,9 @@ async function readSourceFile(absolutePath) {
25
21
  return undefined;
26
22
  }
27
23
  }
24
+ function loadSourceContent(path, context) {
25
+ return context.handlers.has('html') ? readSourceFile(join(context.repoRoot, path)) : Promise.resolve(undefined);
26
+ }
28
27
  export function countLines(lines) {
29
28
  const totalLines = Object.keys(lines).length;
30
29
  const coveredLines = Object.values(lines).filter((v) => v === 1).length;
@@ -56,18 +55,15 @@ async function processEntries(items, context, getName, resolveLines) {
56
55
  return { processed, totalLines, coveredLines };
57
56
  }
58
57
  export function processDeployCoverage(data, context) {
59
- return processEntries(Object.keys(data), context, (fileName) => fileName, async (fileName, path) => {
60
- const fileInfo = data[fileName];
61
- const result = await setCoveredLines(path, context.repoRoot, fileInfo.s, context.handlers.has('html'));
62
- const updatedLines = hasSourceContent(result) ? result.updatedLines : result;
63
- fileInfo.s = updatedLines;
64
- return { lines: updatedLines, sourceContent: hasSourceContent(result) ? result.sourceContent : undefined };
65
- });
58
+ return processEntries(Object.keys(data), context, (fileName) => fileName, async (fileName, path) => ({
59
+ lines: data[fileName].s,
60
+ sourceContent: await loadSourceContent(path, context),
61
+ }));
66
62
  }
67
63
  export function processTestCoverage(data, context) {
68
64
  return processEntries(data, context, (entry) => entry.name, async (entry, path) => ({
69
65
  lines: entry.lines,
70
- sourceContent: context.handlers.has('html') ? await readSourceFile(join(context.repoRoot, path)) : undefined,
66
+ sourceContent: await loadSourceContent(path, context),
71
67
  }));
72
68
  }
73
69
  //# sourceMappingURL=coverageProcessor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"coverageProcessor.js","sourceRoot":"","sources":["../../src/transformers/coverageProcessor.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,YAAY,CAAC;AAEb,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAA8B,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAS1F,MAAM,UAAU,cAAc,CAAC,OAAiB;IAC9C,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAiD,CAAC;IAC1E,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;IACnD,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ACjB,OAAO,EACP,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,EACtB,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QACzB,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvB,aAAa,EAAE,MAAM,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC;KACtD,CAAC,CACH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,IAAwB,EACxB,OAAkC;IAElC,OAAO,cAAc,CACnB,IAAI,EACJ,OAAO,EACP,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EACrB,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QACtB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,aAAa,EAAE,MAAM,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC;KACtD,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -131,5 +131,5 @@
131
131
  ]
132
132
  }
133
133
  },
134
- "version": "3.1.11"
134
+ "version": "4.0.0"
135
135
  }
package/package.json CHANGED
@@ -1,34 +1,34 @@
1
1
  {
2
2
  "name": "apex-code-coverage-transformer",
3
3
  "description": "Transform Salesforce Apex code coverage JSON for SonarQube, SonarCloud, GitHub, GitLab, Azure, and Bitbucket",
4
- "version": "3.1.11",
4
+ "version": "4.0.0",
5
5
  "dependencies": {
6
- "@oclif/core": "5.1.2",
7
- "@salesforce/core": "9.2.0",
8
- "@salesforce/sf-plugins-core": "13.0.4"
6
+ "@oclif/core": "5.1.10",
7
+ "@salesforce/core": "9.4.4",
8
+ "@salesforce/sf-plugins-core": "13.0.8"
9
9
  },
10
10
  "devDependencies": {
11
11
  "@actions/core": "3.0.1",
12
- "@biomejs/biome": "2.5.14",
13
- "@commitlint/cli": "21.2.3",
14
- "@commitlint/config-conventional": "21.2.3",
15
- "@salesforce/cli-plugins-testkit": "5.3.66",
12
+ "@biomejs/biome": "2.6.5",
13
+ "@commitlint/cli": "21.2.4",
14
+ "@commitlint/config-conventional": "21.2.4",
15
+ "@salesforce/cli-plugins-testkit": "5.3.83",
16
16
  "@salesforce/dev-config": "4.3.3",
17
- "@stryker-mutator/core": "10.0.0",
18
- "@stryker-mutator/vitest-runner": "10.0.0",
19
- "@types/node": "26.6.3",
20
- "@vitest/coverage-v8": "5.0.2",
17
+ "@stryker-mutator/core": "10.1.1",
18
+ "@stryker-mutator/vitest-runner": "10.1.1",
19
+ "@types/node": "26.6.6",
20
+ "@vitest/coverage-v8": "5.0.5",
21
21
  "esbuild": "0.28.2",
22
22
  "husky": "9.1.7",
23
- "knip": "6.38.0",
23
+ "knip": "6.44.1",
24
24
  "lint-staged": "17.6.0",
25
25
  "ls-engines": "0.10.1",
26
- "oclif": "6.0.2",
26
+ "oclif": "6.0.15",
27
27
  "shx": "0.4.0",
28
28
  "tsx": "4.23.15",
29
29
  "typescript": "7.0.2",
30
- "vitest": "5.0.2",
31
- "wireit": "0.14.13"
30
+ "vitest": "5.0.5",
31
+ "wireit": "0.15.0"
32
32
  },
33
33
  "engines": {
34
34
  "node": ">=22.19.0"
@@ -92,6 +92,7 @@
92
92
  "clean:build": "wireit",
93
93
  "clean:package-manager": "wireit",
94
94
  "compile": "wireit",
95
+ "dependencies:upgrade": "npx npm-check-updates -u && npm install && npm audit fix",
95
96
  "format": "wireit",
96
97
  "lint": "wireit",
97
98
  "lint:dependencies": "wireit",
@@ -175,22 +176,24 @@
175
176
  "clean": "if-file-deleted"
176
177
  },
177
178
  "format": {
178
- "command": "biome format --write src test",
179
+ "command": "biome format --write src test README.md CONTRIBUTING.md",
179
180
  "files": [
180
181
  "src/**/*.ts",
181
182
  "test/**/*.ts",
182
- "biome.json"
183
+ "biome.json",
184
+ "*.md"
183
185
  ],
184
186
  "output": []
185
187
  },
186
188
  "lint": {
187
- "command": "biome check src test",
189
+ "command": "biome check src test README.md CONTRIBUTING.md",
188
190
  "files": [
189
191
  "src/**/*.ts",
190
192
  "test/**/*.ts",
191
193
  "messages/**",
192
194
  "biome.json",
193
- "**/tsconfig.json"
195
+ "**/tsconfig.json",
196
+ "*.md"
194
197
  ],
195
198
  "output": []
196
199
  },
@@ -332,6 +335,6 @@
332
335
  "url": "https://github.com/mcarvin8/apex-code-coverage-transformer/issues"
333
336
  },
334
337
  "allowScripts": {
335
- "esbuild@0.28.1": true
338
+ "esbuild@0.28.2": true
336
339
  }
337
340
  }
@@ -1,5 +0,0 @@
1
- export type GetTotalLinesResult = number | {
2
- totalLines: number;
3
- content: string;
4
- };
5
- export declare function getTotalLines(filePath: string, returnContent?: boolean): Promise<GetTotalLinesResult>;
@@ -1,8 +0,0 @@
1
- 'use strict';
2
- import { readFile } from 'node:fs/promises';
3
- export async function getTotalLines(filePath, returnContent = false) {
4
- const content = await readFile(filePath, 'utf8');
5
- const totalLines = content.split(/\r\n|\r|\n/).length;
6
- return returnContent ? { totalLines, content } : totalLines;
7
- }
8
- //# sourceMappingURL=getTotalLines.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getTotalLines.js","sourceRoot":"","sources":["../../src/utils/getTotalLines.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAI5C,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,QAAgB,EAAE,aAAa,GAAG,KAAK;IACzE,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACjD,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC;IACtD,OAAO,aAAa,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;AAC9D,CAAC"}
@@ -1,5 +0,0 @@
1
- export type SetCoveredLinesResult = Record<string, number> | {
2
- updatedLines: Record<string, number>;
3
- sourceContent: string;
4
- };
5
- export declare function setCoveredLines(filePath: string, repoRoot: string, lines: Record<string, number>, returnSourceContent?: boolean): Promise<SetCoveredLinesResult>;
@@ -1,38 +0,0 @@
1
- 'use strict';
2
- import { join } from 'node:path';
3
- import { getTotalLines } from './getTotalLines.js';
4
- function debugLog(message) {
5
- if (process.env.SF_LOG_LEVEL === 'debug') {
6
- // eslint-disable-next-line no-console
7
- console.debug(`[DEBUG] setCoveredLines: ${message}`);
8
- }
9
- }
10
- export async function setCoveredLines(filePath, repoRoot, lines, returnSourceContent = false) {
11
- const result = await getTotalLines(join(repoRoot, filePath), returnSourceContent);
12
- const totalLines = typeof result === 'number' ? result : result.totalLines;
13
- const updatedLines = {};
14
- const usedLines = new Set();
15
- const sortedLines = Object.entries(lines).sort(([lineA], [lineB]) => parseInt(lineA, 10) - parseInt(lineB, 10));
16
- for (const [line, status] of sortedLines) {
17
- const lineNumber = parseInt(line, 10);
18
- if (status === 1 && lineNumber > totalLines) {
19
- for (let randomLine = 1; randomLine <= totalLines; randomLine++) {
20
- if (!usedLines.has(randomLine)) {
21
- debugLog(`Remapping out-of-range covered line ${lineNumber} to line ${randomLine} in ${filePath} (file has ${totalLines} lines)`);
22
- updatedLines[randomLine.toString()] = status;
23
- usedLines.add(randomLine);
24
- break;
25
- }
26
- }
27
- }
28
- else {
29
- updatedLines[line] = status;
30
- usedLines.add(lineNumber);
31
- }
32
- }
33
- if (returnSourceContent && typeof result !== 'number') {
34
- return { updatedLines, sourceContent: result.content };
35
- }
36
- return updatedLines;
37
- }
38
- //# sourceMappingURL=setCoveredLines.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setCoveredLines.js","sourceRoot":"","sources":["../../src/utils/setCoveredLines.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAMnD,SAAS,QAAQ,CAAC,OAAe;IAC/B,IAAI,OA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