Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add temporary istambul report file #70

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ThWoywod
Copy link

I add the ability to generate a temporary coverage report file like nyc did it.
On this way we are able to merge multiple test coverage reports into a single report file.
For example, if you use a monorepository with multiple project and each of these projects should generate his own once but these report should be summed up in one report.

@codecov-io
Copy link

codecov-io commented Jun 18, 2019

Codecov Report

Merging #70 into master will increase coverage by 0.19%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #70      +/-   ##
=========================================
+ Coverage    97.7%   97.9%   +0.19%     
=========================================
  Files           2       2              
  Lines         131     143      +12     
=========================================
+ Hits          128     140      +12     
  Misses          3       3
Impacted Files Coverage Δ
src/reporter.js 98.03% <100%> (+0.26%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df3d5df...20e1e4a. Read the comment docs.

@ThWoywod ThWoywod force-pushed the feature/temporary-coverage-report-file branch from 47ceb1b to 20e1e4a Compare June 19, 2019 07:07
Copy link
Owner

@mattlewis92 mattlewis92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So sorry about the late reply on this, I completely missed your PR 😞

This is looking good, thank you! I just had a couple of small comments around some issues I spotted.

const tempFolder = coverageConfig.tempDirectory;

if (fs.existsSync(tempFolder) === true) {
fs.removeSync(tempFolder);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing this will wipe the temp directory on every run, so from what I can tell only one coverage file will ever be written there and when you run nyc merge .nyc_output coverage.json it won't include output files from all runs.

I guess we also want an option to control whether to delete the temp directory, so you could set it to delete it only on the first repo that runs and then subsequent repos in your mono repo wouldn't delete it. This is kind of how the nyc example works, where cover:integration uses --no-clean to not wipe the output directory before running.

WDYT?

JSON.stringify(temporaryFileDateResult)
);
} else {
log.warn('No coverage data found');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will always log when you're not using the tempDirectory option. Can you also make it debug level as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants