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

Provide option to override 'out.json' file name in writeIstanbulFormat #63

Open
babaosoftware opened this issue Mar 11, 2021 · 2 comments

Comments

@babaosoftware
Copy link

The file is being overwritten every time a new test suite runs (more precisely, every time "write" is being called), making it impossible to merge the code coverage for multiple test suites.
If separate files are generated for each test suite, then a merged report can be created with "nyc report".
For example, at the end of a test suite I can put something like this:

afterAll(async () => {
    const [jsCoverage, cssCoverage] = await Promise.all([
        page.coverage.stopJSCoverage(),
        page.coverage.stopCSSCoverage(),
    ]);
    await pti.write([...jsCoverage, ...cssCoverage], {outputName: 'my-test-output'});
    }
});

and then use that option in https://github.com/istanbuljs/puppeteer-to-istanbul/blob/master/lib/puppeteer-to-istanbul.js
line 27:
const outFilePath =${this.storagePath}/${this.options.outputName || 'out'}.json
This way the test suites will generate separate files, that can be at the end merged with "nyc report".

@umarkhanTR
Copy link

This issue is still open. Any ETA on fixing this overwriting logs behavior? Or any work around?

@Aaron3963
Copy link

Upvoting on this. I have to run one test, rename it before I can run the next one. Should be an easy fix as babao suggested.

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

No branches or pull requests

3 participants