AriPerkkio / vitest-sonar-reporter

SonarQube reporter for Vitest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Option to silence output

ouuan opened this issue · comments

I don't want to see the "SonarQube report written to" line in the test output, so I'd like an option to silence it.

The current behaviour is following Vitest's internal reporters logging. Even those ones cannot be silenced:

But I think this would be useful as those verbose logs may be unnecessary in most cases. Maybe something like below:

export default defineConfig({
    test: {
        reporters: 'vitest-sonar-reporter',
        sonarReporterOptions: {
            silent: true,
        },
    },
});

This is now included in version 0.4.0.

Thanks for the quick implementation! But it causes a type error:

vitest.config.ts:6:5 - error TS2322: Type '{ reporters: ("default" | "vitest-sonar-reporter")[]; sonarReporterOptions: { silent: true; }; outputFile: { 'vitest-sonar-reporter': string; }; coverage: { all: true; exclude: string[]; reporter: ("text" | "lcov")[]; }; }' is not assignable to type 'InlineConfig'.
  Object literal may only specify known properties, and 'sonarReporterOptions' does not exist in type 'InlineConfig'.

6     sonarReporterOptions: { silent: true },

Note that passing custom options to Vitest reporters is unconventional and may require you to use @ts-ignore when using TypeScript.

You'll need to use

// @ts-ignore
sonarReporterOptions: { silent: true },

https://github.com/AriPerkkio/vitest-sonar-reporter/blob/main/README.md#options

Sorry I didn't notice the documentation. (It will be easier to see if it's in the code instead of above the silent heading.)