mo3ta-coverage 1.0.6 → 1.0.7
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 +2 -2
- package/index.js +1 -1
- package/package.json +1 -1
- package/src/cli.js +4 -2
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
## Usage
|
|
15
15
|
|
|
16
16
|
```sh
|
|
17
|
-
mo3ta-coverage --base origin/
|
|
17
|
+
mo3ta-coverage --base origin/master --lcov coverage/lcov.info --limit 80 --showCovered --shallowTests=false
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
## CLI Options
|
|
@@ -25,7 +25,7 @@ mo3ta-coverage --base origin/main --lcov coverage/lcov.info --limit 80 --showCov
|
|
|
25
25
|
| `--lcov` | Path to lcov.info file generated by test coverage tools | `coverage/lcov.info` |
|
|
26
26
|
| `--limit` | Minimum required coverage percentage for all changed lines | `80` |
|
|
27
27
|
| `--showCovered` | Show covered changed lines in the output | `false` |
|
|
28
|
-
| `--
|
|
28
|
+
| `--shallowTests` | Run test files only, skipping other files | `true` |
|
|
29
29
|
|
|
30
30
|
## How It Works
|
|
31
31
|
|
package/index.js
CHANGED
|
@@ -11,7 +11,7 @@ program
|
|
|
11
11
|
.option('--lcov <path>', 'Path to lcov.info file generated by test coverage tools', 'coverage/lcov.info')
|
|
12
12
|
.option('--limit <percent>', 'Minimum required coverage percentage for all changed lines (e.g., 80)', '80')
|
|
13
13
|
.option('--showCovered', 'Show covered changed lines in the output', false)
|
|
14
|
-
.option('--
|
|
14
|
+
.option('--shallowTests', 'Run test files only without deep in tests tree', true);
|
|
15
15
|
|
|
16
16
|
program.parse(process.argv);
|
|
17
17
|
const options = program.opts();
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -18,7 +18,7 @@ export function main(options) {
|
|
|
18
18
|
const LCOV_PATH = options.lcov;
|
|
19
19
|
const COVERAGE_LIMIT = parseFloat(options.limit);
|
|
20
20
|
const SHOW_COVERED = options.showCovered === true || options.showCovered === 'true';
|
|
21
|
-
const RUN_TESTS_ONLY = options.
|
|
21
|
+
const RUN_TESTS_ONLY = options.shallowTests === true || options.shallowTests === 'true';
|
|
22
22
|
|
|
23
23
|
console.log(`Options:\nBase Branch: ${BASE_BRANCH} \nLCOV Path: ${LCOV_PATH} \nCoverage Limit: ${COVERAGE_LIMIT} \nShow Covered Lines: ${SHOW_COVERED} \nRun Tests Only: ${RUN_TESTS_ONLY}`);
|
|
24
24
|
|
|
@@ -81,7 +81,9 @@ function getJsOnlyFiles(files, runTestsOnly) {
|
|
|
81
81
|
// Only include source code files, exclude test, config, and json files
|
|
82
82
|
return files.filter(f => {
|
|
83
83
|
// Exclude test files
|
|
84
|
-
if (f.match(/(\.test|\.spec)\.(js|ts|jsx|tsx)$/)) return false
|
|
84
|
+
if (f.match(/(\.test|\.spec)\.(js|ts|jsx|tsx)$/)) return false;
|
|
85
|
+
// skip non test files when running only test files
|
|
86
|
+
if (runTestsOnly) return false;
|
|
85
87
|
// Exclude config files
|
|
86
88
|
if (f.match(/(jest|babel|webpack|tsconfig|eslint|prettier|rollup|vite|package)\.(js|ts|json)$/)) return false;
|
|
87
89
|
// Exclude json files
|