mo3ta-coverage 1.0.2 → 1.0.3

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. 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.2",
3
+ "version": "1.0.3",
4
4
  "description": "Run tests and report uncovered changed lines in a PR",
5
5
  "main": "index.js",
6
6
  "bin": {
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 output = execSync(`git diff --name-only ${BASE_BRANCH}`).toString();
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
- // if (f.match(/(\.test|\.spec)\.(js|ts|jsx|tsx)$/)) return false;
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