Skip to content

Commit

Permalink
feat: support all vitest built in reporters (#588)
Browse files Browse the repository at this point in the history
  • Loading branch information
beaussan authored Apr 7, 2024
1 parent 9b4e0d9 commit 038c485
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
12 changes: 12 additions & 0 deletions packages/knip/fixtures/plugins/vitest3/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ export default defineConfig(configEnv =>
globals: true,
include: ['**/*.test.{ts,tsx}'],
setupFiles: ['./src/setupTests.tsx'],
reporters: [
'basic',
'verbose',
'dot',
'junit',
'json',
'html',
'tap',
'tap-flat',
'hanging-process',
'github-actions',
],
mockReset: true,
coverage: {
provider: 'v8',
Expand Down
15 changes: 14 additions & 1 deletion packages/knip/src/plugins/vitest/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,20 @@ export const getEnvPackageName = (env: string) => {
return `vitest-environment-${env}`;
};

const builtInReporters = ['default', 'verbose', 'dot', 'json', 'tap', 'tap-flat', 'junit', 'hanging-process'];
// See full list here : https://github.com/vitest-dev/vitest/blob/main/packages/vitest/src/node/reporters/index.ts#L30
const builtInReporters = [
'basic',
'default',
'dot',
'github-actions',
'hanging-process',
'html',
'json',
'junit',
'tap',
'tap-flat',
'verbose',
];

export const getExternalReporters = (reporters?: ViteConfig['test']['reporters']) =>
reporters
Expand Down

0 comments on commit 038c485

Please sign in to comment.