question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Coverage Overwritten after each testsuite

See original GitHub issue

Hello!

I have a StencilJS project (version 0.14.0) and they have started using Puppeteer, they have provided a small library to implement Puppeteer tests. I have implemented your dependency the way you have documented it. However if I do the same setup in each test file the previous coverage appears to get overwritten. This is reflected when I generate the nyc report. Here is my general setup for each test file.

`import { newE2EPage, E2EPage } from ‘@stencil/core/testing’; import * as pti from ‘puppeteer-to-istanbul’;

describe(‘my-component’, () => { let page: E2EPage;

beforeEach(async () => { page = await newE2EPage(); await page.coverage.startJSCoverage(); });

afterEach(async () => { const jsCoverage = await page.coverage.stopJSCoverage();

pti.write(jsCoverage);

});`

Please let me know if there is any more information that you need. Thank you for your time, speak to you soon hopefully!

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:4
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
joe223commented, Nov 6, 2019

Every Page instance would generate a new puppeteerFormat. How could we merge multiple puppeteerFormat data?

Ref: https://github.com/istanbuljs/puppeteer-to-istanbul/blob/c57bd741534813a7b42c8f300ddb61ef42086ef1/index.js#L4

Update We should set jsonPart as a top scoped variable in puppeteer-to-istanbul, so every page instance test coverage record could be stored. https://github.com/istanbuljs/puppeteer-to-istanbul/blob/de9109c794523eb8924ef24770503908650cc952/lib/puppeteer-to-istanbul.js#L35-L45

Besides iterator should be same as jsonPart https://github.com/istanbuljs/puppeteer-to-istanbul/blob/de9109c794523eb8924ef24770503908650cc952/lib/output-files.js#L62-L66 And, should not save file as ${parsedPath}-${this.iterator}.js if it is inline.

Update This is the fix PR https://github.com/istanbuljs/puppeteer-to-istanbul/pull/42

2reactions
ps011commented, Nov 15, 2018

Maybe you can use beforeAll and afterAll

Read more comments on GitHub >

github_iconTop Results From Across the Web

Generate new code coverage for a single file without clearing ...
1 Answer 1 · Copy the coverage XML for a full run to a staging area. · When running a single test, copy...
Read more >
Tutorial - Measuring code coverage - JMockit
Code coverage consists of a set of software metrics that can tell you how much of the production code is covered by a...
Read more >
Coverage - The Haskell Tool Stack
Code coverage is a measure of the degree to which the source code of a program is executed when a test suite is...
Read more >
Chapter 13 Maximizing Coverage - Reactive Systems
Make sure Coverage > Show Details is selected, and run all tests in the suite. ... in the following sections to enhance the...
Read more >
Analyze Model Coverage by Using the Test Manager in ...
You can run multiple tests in a test suite, analyze coverage for each test, then view the aggregated results for the result set...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found