Hi there wave I beli…

1 minute read

Hi there :wave:,

I believe there is something wrong with the generated html code coverage reports, but I’m not yet sure where to file this bug. I hope you can help me find where the problem is and file the bug in the right project. It has to do with the html code coverage reports and relative links. Here’s how to reproduce:

  • npx create-nx-workspace@latest
  • nx g library feature-a
  • nx generate @schematics/angular:component --name=feature-a-list --project=feature-a --style=scss
  • add collectCoverage: true to the root jest.config.js
  • nx test
  • npx serve coverage

This last command will allow you to browse the contents of the coverage directory going to a specific app or lib. From the moment you open libs/feature-a and click to feature-a-list, you already notice stylesheets go missing. The html page has them pointing to ../../base.css for instance (which becomes <http://localhost:5000/libs/base.css> instead of <http://localhost:5000/libs/feature-a/base.css>, so it should be ../base.css). Trying to see the coverage of the component, the link to the file is also broken: it is generated as feature-a-list.component.ts.html where it should be feature-a-list/feature-a-list.component.ts.html.

My question now would be, is this a bug in @nrwl/jest, jest-preset-angular, jest or one of Jest’s dependencies that are responsible for generating the code coverage (and/or html report)?

Responses:

nx version output:

```Angular CLI: 9.0.1 Node: 14.2.0 OS: darwin x64

Angular: 9.0.0 … animations, common, compiler, compiler-cli, core, forms … language-service, platform-browser, platform-browser-dynamic … router Ivy Workspace: Yes

Package Version

@angular-devkit/architect 0.900.3 @angular-devkit/build-angular 0.900.1 @angular-devkit/build-optimizer 0.900.1 @angular-devkit/build-webpack 0.900.1 @angular-devkit/core 9.0.3 @angular-devkit/schematics 9.0.3 @angular/cli 9.0.1 @ngtools/webpack 9.0.1 @schematics/angular 9.0.3 @schematics/update 0.900.1 rxjs 6.5.3 typescript 3.7.5 webpack 4.41.2```

Updated: