mo3ta-coverage 1.0.2 → 1.0.4
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/package.json +18 -1
- package/src/cli.js +9 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mo3ta-coverage",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Run tests and report uncovered changed lines in a PR",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -10,6 +10,23 @@
|
|
|
10
10
|
"author": "Mahmoud Mabrok",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"type": "module",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"coverage",
|
|
15
|
+
"test",
|
|
16
|
+
"jest",
|
|
17
|
+
"git",
|
|
18
|
+
"ci",
|
|
19
|
+
"code-coverage",
|
|
20
|
+
"pull-request",
|
|
21
|
+
"diff"
|
|
22
|
+
],
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/MahmoudMabrok/mo3ta-coverage.git"
|
|
26
|
+
},
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/MahmoudMabrok/mo3ta-coverage/issues"
|
|
29
|
+
},
|
|
13
30
|
"devDependencies": {
|
|
14
31
|
"@babel/core": "^7.28.0",
|
|
15
32
|
"@babel/preset-env": "^7.28.0",
|
package/src/cli.js
CHANGED
|
@@ -28,7 +28,14 @@ export function main(options) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
function getChangedFiles(BASE_BRANCH) {
|
|
31
|
-
const
|
|
31
|
+
const command = `(
|
|
32
|
+
git log --pretty=format: --name-only --diff-filter=AM --author="$(git config user.name)" $(git merge-base HEAD ${BASE_BRANCH})..HEAD
|
|
33
|
+
git diff --name-only --diff-filter=AM
|
|
34
|
+
git diff --cached --name-only --diff-filter=AM
|
|
35
|
+
) | sort -u`;
|
|
36
|
+
|
|
37
|
+
const output = execSync(command).toString();
|
|
38
|
+
|
|
32
39
|
return output
|
|
33
40
|
.split('\n')
|
|
34
41
|
.filter(f => f.trim().length > 0 && f.match(/\.(js|ts|jsx|tsx)$/));
|
|
@@ -68,7 +75,7 @@ function getJsOnlyFiles(files) {
|
|
|
68
75
|
// Only include source code files, exclude test, config, and json files
|
|
69
76
|
return files.filter(f => {
|
|
70
77
|
// Exclude test files
|
|
71
|
-
|
|
78
|
+
if (f.match(/(\.test|\.spec)\.(js|ts|jsx|tsx)$/)) return false;
|
|
72
79
|
// Exclude config files
|
|
73
80
|
if (f.match(/(jest|babel|webpack|tsconfig|eslint|prettier|rollup|vite|package)\.(js|ts|json)$/)) return false;
|
|
74
81
|
// Exclude json files
|