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

Zero coverage #11

Closed
SgtPooki opened this issue Aug 25, 2022 · 2 comments
Closed

Zero coverage #11

SgtPooki opened this issue Aug 25, 2022 · 2 comments

Comments

@SgtPooki
Copy link

I tried adding test coverage to https://github.com/ipfs/ipfs-webui, with the changes made at https://github.com/SgtPooki/ipfs-webui/tree/test-coverage-with-bgotink, but it results in zero coverage:

=============================== Coverage summary ===============================
Statements   : Unknown% ( 0/0 )
Branches     : Unknown% ( 0/0 )
Functions    : Unknown% ( 0/0 )
Lines        : Unknown% ( 0/0 )
================================================================================
@bgotink
Copy link
Owner

bgotink commented Aug 25, 2022

The sourceRoot is configured to the test folder, not the repository root. With that fixed, coverage does come through:

diff --git a/test/e2e/playwright.config.js b/test/e2e/playwright.config.js
index 78613e8..6b790a4 100644
--- a/test/e2e/playwright.config.js
+++ b/test/e2e/playwright.config.js
@@ -16,7 +16,7 @@ const config = {
       '@bgotink/playwright-coverage',
       /** @type {import('@bgotink/playwright-coverage').CoverageReporterOptions} */ {
         // Path to the root files should be resolved from, most likely your repository root
-        sourceRoot: path.join(__dirname, '..'),
+        sourceRoot: path.join(__dirname, '../..'),
         // Files to ignore in coverage, useful
         // - if you're testing the demo app of a component library and want to exclude the demo sources
         // - or part of the code is generated
$ npm run test:e2e --grep explore.test

> ipfs-webui@2.17.3 test:e2e
> npx playwright test -c ./test/e2e "explore.test"


Running 2 tests using 2 workers

[WebServer] (node:41284) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
(Use `node --trace-deprecation ...` to show where the warning was created)
  ✓  explore.test.js:20:3 › Explore screen › should open arbitrary CID (859ms)
  ✓  explore.test.js:14:3 › Explore screen › should have Project Apollo Archive as one of examples (635ms)


  2 passed (5s)

=============================== Coverage summary ===============================
Statements   : 79.09% ( 5456/6898 )
Branches     : 70.02% ( 327/467 )
Functions    : 33.88% ( 122/360 )
Lines        : 79.09% ( 5456/6898 )
================================================================================

@bgotink bgotink closed this as completed Aug 26, 2022
@SgtPooki
Copy link
Author

SgtPooki commented Sep 7, 2022

ty. I did get it figured out with ipfs/ipfs-webui#2014

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

2 participants