Vitest

A guide for generating JUnit test reports for Vitest tests

1. Generate JUnit

Update your Vitest config to include the junit reporter:

import { defineConfig } from 'vitest/config';

export default defineConfig({
  test: {
    reporters: [
      ['junit', { outputFile: './junit.xml' }],
    ],
  },
});

2. Output Location

The JUnit report will be written to the outputFile specified in the Vite config. In the example above, the report would be written to ./junit.xml.

Next Step

JUnit files generated with Vitest are compatible with Trunk Flaky Tests. See CI Providers for a guide on how to upload test results to Trunk.

Last updated