vitest-dev / vitest

Next generation testing framework powered by Vite.
https://vitest.dev
MIT License
12.87k stars 1.15k forks source link

vitest dot reporter is not used in CI (jenkins) #3932

Open vandriesh opened 1 year ago

vandriesh commented 1 year ago

Describe the bug

with viteconfig

test: {
    globals: true,
    environment: 'jsdom',
    setupFiles: './tests/setup.ts',
    reporters: ['dot'],
    coverage: {
        provider: 'v8',
        reportsDirectory: './reports/coverage-vitest',
        reporter: [['lcov']],
        lines: 3,
        functions: 3,
        branches: 3,
        statements: 3,
    },
},

or command line

  npx vitest --reporter dot

work on "my machine" (osx)

but it doesn't in CI (jenkins)

Screen Shot 2023-08-11 at 10 20 01

Reproduction

hard to build env with jenkins and share it,

System Info

10:28:09  + npx envinfo --system --npmPackages '{vitest,@vitest/*,vite,@vitejs/*}' --binaries --browsers
10:28:10  npm WARN exec The following package was not found and will be installed: envinfo@7.10.0
10:28:11  
10:28:11    System:
10:28:11      OS: Linux 5.4 Amazon Linux 2
10:28:11      CPU: (16) x64 Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
10:28:11      Memory: 121.03 GB / 124.36 GB
10:28:11      Container: Yes
10:28:11      Shell: 4.2.46 - /bin/bash
10:28:11    Binaries:
10:28:11      Node: 16.20.0 - /usr/local/lib/nodejs/node-v16.20.0-linux-x64/bin/node
10:28:11      npm: 8.19.4 - /usr/local/lib/nodejs/node-v16.20.0-linux-x64/bin/npm
1

Used Package Manager

npm

Validations

AriPerkkio commented 1 year ago

In CI the terminal is not interactive, meaning that terminal cannot be cleared.

What is the expected output a dot reporter would produce in this kind of environment? Currently this is intentionally disabled:

https://github.com/vitest-dev/vitest/blob/f4e6e99fa3a81fd7a97fb9b435da367dddba7fa4/packages/vitest/src/node/reporters/dot.ts#L10-L16

vandriesh commented 1 year ago

not sure I understand - I was expecting this (actual dot report) instead : green check marks + files names Screen Shot 2023-08-13 at 21 58 27

AriPerkkio commented 1 year ago

I think we could render the dots of the test final result (green/red) and don't care about test-in-progress states (yellow dots).

vandriesh commented 1 year ago

I'd love to WYSIWYG (what you see is what you get) here. The main issue it would solve is the end the holy war between FE and devops devs. When devops sees tons of info (sometimes red/or exceptions) - they point out - it our fault. I want to output ass less as possible info easy to investigate when you have 1 page of logs instead of 5) ;-) - so I'd really like to see same output everywhere (regardless where vitest is running - local os CI)

Thanks!

p.s. Should I open a PR or something - once you pointed the code...

vandriesh commented 1 year ago

just saw pr welcome tag - I guess that answers my question