+
Skip to content

Incorrect coverage reports #822

Closed
@jeremyhofer

Description

@jeremyhofer

Please provide the environment you discovered this bug in.

Having issues getting StackBlitz to cooperate. Here's a repo that reproduces:

https://github.com/jeremyhofer/demo-analog-incorrect-test-coverage

For some reason npm run test, despite adding the coverage: true option to the test target in angular.json is not generating coverage. I think this may be a @nx/vite plugin executor thing with the version I'm testing in this repo. Due to this I am running tests via npx vitest --coverage in this reproduction. However, in my actual project I am running/generating coverage with nx test <app> with no impact.

Which area/package is the issue in?

Don't know / other

Description

Coverage reports generated as part of unit tests for any file in the analog /src directory have incorrect coverage reports.

An example visual of the coverage reported for the app.component.ts that is scaffolded with a new analog app, with an untested function added to the component:
1703901542
1703901770

Incorrect coverage reports such as this are being generated for any and all files I try. Angular components, pages, server routes, etc. Each one will report inaccurate coverage results.

I'm not sure exactly where in the stack the source mapping may be getting lost when testing. I'd be happy to dig into this a fair bit if I can be pointed in a starting direction.

Please provide the exception or error you saw

No response

Other information

No response

I would be willing to submit a PR to fix this issue

  • Yes
  • No

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载