mo3ta-coverage 1.0.21 → 1.0.22
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/index.js +22 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -25,8 +25,12 @@ function writeConfig(config) {
|
|
|
25
25
|
|
|
26
26
|
const program = new Command();
|
|
27
27
|
|
|
28
|
+
const PkgPath = new URL('./package.json', import.meta.url);
|
|
29
|
+
const pkgVersion = JSON.parse(fs.readFileSync(PkgPath, 'utf8')).version;
|
|
30
|
+
|
|
28
31
|
program
|
|
29
32
|
.name('mo3ta-coverage')
|
|
33
|
+
.version(pkgVersion, '-V, --version', 'Show the installed version')
|
|
30
34
|
.description('Run tests and report uncovered changed lines in a PR. Checks cumulative coverage for all changed lines against a specified limit. Useful for CI and code review workflows.');
|
|
31
35
|
|
|
32
36
|
program
|
|
@@ -40,6 +44,24 @@ program
|
|
|
40
44
|
.option('--filesFrom <path>', 'Read the list of files to scan from a newline-separated file')
|
|
41
45
|
.enablePositionalOptions(); // used to allow using same options in subcommands
|
|
42
46
|
|
|
47
|
+
// Usage help text (printed next to --help)
|
|
48
|
+
program.showHelpAfterError('(add --help for a list of options)');
|
|
49
|
+
program.addHelpText('after', `
|
|
50
|
+
Examples:
|
|
51
|
+
$ mo3ta-coverage --mode smart --base origin/main --limit 80
|
|
52
|
+
$ mo3ta-coverage --files src/a.js,src/b.ts --base origin/main
|
|
53
|
+
$ mo3ta-coverage --filesFrom changed.txt --base origin/main
|
|
54
|
+
$ mo3ta-coverage --mode fast --showCovered true
|
|
55
|
+
$ mo3ta-coverage config --mode smart --depth 2
|
|
56
|
+
$ mo3ta-coverage --version
|
|
57
|
+
|
|
58
|
+
Modes:
|
|
59
|
+
fast Naming-convention matches, plus a direct import-scan fallback.
|
|
60
|
+
smart Naming + reverse-import walk, bounded by --depth (default 2).
|
|
61
|
+
full Passes changed files to "jest --findRelatedTests".
|
|
62
|
+
|
|
63
|
+
See README.md for details: https://github.com/MahmoudMabrok/mo3ta-coverage`);
|
|
64
|
+
|
|
43
65
|
|
|
44
66
|
program
|
|
45
67
|
.command('config')
|