cenfun / monocart-reporter

A playwright test reporter (Node.js)
https://cenfun.github.io/monocart-reporter/
MIT License
196 stars 11 forks source link

[Help] Duplicate file on coverage reporter html #154

Open phatpna opened 5 days ago

phatpna commented 5 days ago

Clear and concise description of the issue How to make the report contain only the original file and not the fake rendered file? This is my code to run test

` test.beforeEach(async ({ page }) => { await mockApi(page) await Promise.all([ page.coverage.startJSCoverage({ resetOnNavigation: false }), page.coverage.startCSSCoverage({ resetOnNavigation: false }) ]);
await page.goto('http://localhost:8080'); await page.waitForTimeout(5000); });

test.afterEach(async ({ page }) => { const [jsCoverage, cssCoverage] = await Promise.all([ page.coverage.stopJSCoverage(), page.coverage.stopCSSCoverage() ]);

const coverageData = [...jsCoverage, ...cssCoverage];

await addCoverageReport(coverageData, test.info());

});

test(' Test default showing on page ', async ({ page, mount }) => {

await page.goto('http://localhost:8080'); await page.waitForTimeout(5000); await page.getByRole('link', { name: 'Absence List' }).click(); } `

My playwright.config.ts file:

image

Example look like that: image image

does anyone know why there are 2 files like that, and is there a way I can get just the original file

Thanks in advance

cenfun commented 5 days ago

It seems that it enabled hot reload? try disable it.

phatpna commented 5 days ago

It seems that it enabled hot reload? try disable it.

image image image i have tried many ways ( i I commented in images) but still can't solve

cenfun commented 4 days ago

Could you please provide a minimal reproducible repo? So I can reproduce and debug the issue locally?

phatpna commented 3 days ago

Could you please provide a minimal reproducible repo? So I can reproduce and debug the issue locally?

I'm so sorry, because this is a private repo, i use playwright in the same container with Web, i think maybe you are right. I still can't solve this, but i will try more ways about hot reload. Could you please give me some advices might cause the issue i got ? Thank you in advanced

cenfun commented 3 days ago

My suggestion is that don't use develop mode which is enabled hot reload, but try preview mode or production mode instead.

❌ npm run dev ✅ npm run build + npm run preview

No matter which mode, please enable sourcemap and no minify for the source.

Or you can try vue component testing, see example: https://github.com/cenfun/playwright-ct-vue