Skip to content

@analogjs/vite-plugin-angular: Coverage is not generated correctly in an NX monorepo #1791

Open
@BlindDespair

Description

@BlindDespair

Please provide the environment you discovered this bug in.

https://stackblitz.com/~/github.com/BlindDespair/analogjs-vitest-nx-coverage-bug

For me for some reason the nx commands are not running in Stackblitz, so here's also a GitHub repo:
https://github.com/BlindDespair/analogjs-vitest-nx-coverage-bug

Which area/package is the issue in?

vitest-angular

Description

When using the @analogjs/vite-plugin-angular plugin in vite.config.mts and running tests in NX monorepo with coverage, the coverage is only available for the files that already have tests but not for the rest of them. vite.config.ts specifies all the configs for vitest including coverage. Setting includes and all has no influence over the result. I also tried changing the runner to:

"executor": "@analogjs/vitest-angular:test",
          "options": {
            "coverageArgs": {
              "all": true
            }
          }

and still no luck.
Coverage output looks like this:

Image

But it should be like this (this is when the plugin is removed, but then of course can't test Angular components):

Image

Please provide the exception or error you saw


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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions