playwright-test-coverage icon indicating copy to clipboard operation
playwright-test-coverage copied to clipboard

Does it work for Angular CLI project?

Open sh977218 opened this issue 3 years ago • 2 comments

I tried to so the same for an Angular CLI project. I'd assume having nyc to instrument the ng serve would populate the coverage result into .nyc_output folder. However, I have it populated but the data is empty.

playwright.config.ts

  webServer: {
    command: 'npx nyc ng serve',
    port: 3000,
  },

Why does this not work?

sh977218 avatar Sep 15 '22 20:09 sh977218

@sh977218 have you found a solution?

testgitdl avatar Jan 03 '23 13:01 testgitdl

@testgitdl No, I have not. This repo only works with React, because its ability of modifying the code during compilation. But with Angular's default build, it's very hard to do.

sh977218 avatar Jan 15 '23 03:01 sh977218

for whoever is interested to have nyc code coverage enabled for Angular CLI project, the Angular bootstrap project has a perfect example. Starting from this line, e2e-app/coverage.webpack.js.

sh977218 avatar Sep 16 '24 21:09 sh977218