Generating code coverage on Azure pipelines
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- azure, playwright, typescript, vite
- Domain
- ci-cd, cloud, testing-qa
Research direction
Start with vite.config.ts and baseFixtures.ts, then reproduce the listed Playwright and nyc commands in the Azure pipeline environment. Compare the local and pipeline coverage-output behavior; done means JSON coverage files are created under the generated output directory and npx nyc report --reporter=text produces a report.
Written by the indexing model from the issue text.
Description
System info
● Playwright Version: Latest
● Operating System: Win 11
● Browser: MS Edge
Steps
npm i && npx playwright install --with-deps
npm i vite-plugin-istanbul
npm i nyc
npx playwright test --project "e2e tests on pipeline"
npx nyc report --reporter=text
Configs:
vite.config.ts
baseFixtures.ts
`import * as fs from 'fs'
import * as path from 'path'
import * as crypto from 'crypto'
import { fileURLToPath } from 'url'
import { test as baseTest } from '@playwright/test'
const filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(filename)
const istanbulCLIOutput = path.join(__dirname, '..', '.nyc_output')
export function generateUUID(): string {
return crypto.randomBytes(16).toString('hex')
}
export const test = baseTest.extend({
context: async ({ context }, use) => {
await context.addInitScript(() =>
window.addEventListener('beforeunload', () =>
(window as any).collectIstanbulCoverage(JSON.stringify((window as any).coverage)),
),
)
await fs.promises.mkdir(istanbulCLIOutput, { recursive: true })
await context.exposeFunction('collectIstanbulCoverage', (coverageJSON: string) => {
if (coverageJSON)
fs.writeFileSync(path.join(istanbulCLIOutput, playwright_coverage_${generateUUID()}.json), coverageJSON)
})
await use(context)
for (const page of context.pages()) {
await page.evaluate(() => (window as any).collectIstanbulCoverage(JSON.stringify((window as any).coverage)))
}
},
})
export const expect = test.expect`
Expected
When running the tests locally, the coverage json files are generated under the nyc_report folder as expected and the report can be displayed normally either in text or html form.
On the azure pipeline environment, all tests are still passing, the nyc_folder is created but there are no json files created under it.
Thus, this is the output I get from the npx nyc report --reporter=text command.
I am not really sure what I have done incorrectly or whether this tool was never supposed to be able to work on azure pipelines at all though, Some input or tips towards the right direction would be greatly appreciated. Thank you.
- Dominant language
- TypeScript
- Stars
- 143
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mxschmitt/playwright-test-coverage
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
mxschmitt/playwright-test-coverage#22 · 1 comment · 1 reaction ·
-
Example with Remix Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
mxschmitt/playwright-test-coverage#21 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
mxschmitt/playwright-test-coverage#17 · 6 comments ·
All issues in mxschmitt/playwright-test-coverage
Similar issues
-
comp/dashboard P3 type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
NousResearch/hermes-agent#117722 ·
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 76/100
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·