Skip to content

Commit

Permalink
fix(#63): not all node_modules folders are ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
iamtomhewitt authored Oct 29, 2021
1 parent dbddac0 commit cb36c8c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions coverage.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
const fs = require('fs');
const reports = ['/coverage.txt']
const reports = ['/coverage.txt'];
let coverages = 0;

const run = async () => {
await reports.forEach(async (report) => {
const contents = await fs.readFileSync(process.cwd() + report, 'utf-8')
const contents = await fs.readFileSync(process.cwd() + report, 'utf-8');
const result = contents.match(/All\sfiles.*?\s+(.\d\d.\d\d)/);
const coverage = result[1].trim()
coverages += parseFloat(coverage)
const coverage = result[1].trim();
coverages += parseFloat(coverage);
})

console.log(coverages / reports.length)
const finalCoverage = parseFloat(coverages / reports.length).toFixed(2);
console.log(finalCoverage);
}

run();
Expand Down
2 changes: 1 addition & 1 deletion src/git/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {
const cwd = process.cwd();
const git = simpleGit(cwd);
const filesToFind = '**/*(package.json|package-lock.json|pom.xml)';
const files = await glob.sync(filesToFind, { ignore: 'node_modules/**' });
const files = await glob.sync(filesToFind, { ignore: '**/*node_modules/**' });

files.forEach(async (file) => {
const filePath = `${cwd}/${file}`;
Expand Down
2 changes: 1 addition & 1 deletion src/version/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = {
async writeVersion({ newVersion, dryRun }) {
try {
const filesToFind = '**/*(package.json|package-lock.json|pom.xml)';
const files = await glob.sync(filesToFind, { ignore: 'node_modules/**' });
const files = await glob.sync(filesToFind, { ignore: '**/*node_modules/**' });

log.info(`Found ${files.length} files to update: \n\t${files.join(', \n\t')}`);
files.forEach(async (file) => {
Expand Down

0 comments on commit cb36c8c

Please sign in to comment.