vitest icon indicating copy to clipboard operation
vitest copied to clipboard

JUnit Reporter was removed?

Open mattdemichele-pearson opened this issue 3 years ago • 3 comments

Describe the bug

It looks to me like JUnit reporting has broken? What is odd is that the CoverageReporter type actually has "junit" removed as an option, which implies to me that this was intentional?

But then in the documentation, for instance here https://vitest.dev/config/#reporters, "junit" is still referenced as being available.

I added a very basic StackBlitz example that reproduces this issue.

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-es4cbi?file=package.json

I created a very basic reproduction in the StackBlitz above.

All it does is set junit as a reporter in the config, and you can see that it fails.

System Info

System:
    OS: Linux 5.15 Ubuntu 20.04.5 LTS (Focal Fossa)
    CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
    Memory: 11.39 GB / 15.51 GB
    Container: Yes
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v16.13.1/bin/yarn
    npm: 8.1.2 - ~/.nvm/versions/node/v16.13.1/bin/npm
  npmPackages:
    @vitest/coverage-c8: ^0.28.5 => 0.28.5
    @vitest/coverage-istanbul: ^0.28.5 => 0.28.5
    @vitest/ui: ^0.28.5 => 0.28.5
    vite: ^4.1.4 => 4.1.4
    vitest: ^0.28.5 => 0.28.5

Used Package Manager

npm

Validations

mattdemichele-pearson avatar Feb 22 '23 19:02 mattdemichele-pearson

vitest.dev/config/#reporters references reporters option, not coverage.reporters. If you want to set Vitest reporter as junit, use reporters configuration option:

// vitest.config.mjs
export default {
  test: {
    reporters: ['junit']
  }
}

sheremet-va avatar Feb 22 '23 19:02 sheremet-va

Oof, that was a dumb mistake. Sorry for the confusion and I appreciate the response. I'll mark this as closed

mattdemichele-pearson avatar Feb 22 '23 20:02 mattdemichele-pearson

I did the same mistake and end up here. For me the confusion came from this snippet in the documentation: https://vitest.dev/guide/coverage.html#coverage-setup which uses coverage.reporters, so I thought I should use it as well for junit

LuanScudeler avatar Apr 12 '23 09:04 LuanScudeler