Skip to content

v1.1.0 - custom options support

Compare
Choose a tag to compare
@AriPerkkio AriPerkkio released this 17 Feb 08:57
· 27 commits to main since this release

This release adds support for passing custom reporter options. See vitest-dev/vitest#5111 for more information about Vitest's new reporter API. There's also new onWritePath option that can be used to rewrite <file> element's path attributes.

Custom options

import { defineConfig } from "vitest/config";

export default defineConfig({
  test: {
    reporters: [
      "default",
      ["vitest-sonar-reporter", { outputFile: "sonar-report.xml", silent: true }],
      "junit",
    ],
  },
});

onWritePath option

import { defineConfig } from 'vitest/config';

export default defineConfig({
  test: {
    reporters: [
      ['vitest-sonar-reporter', {
        onWritePath(path: string) {
            console.log(path);
            //          ^^^^ "test/fixtures/animals.test.ts"

            return `custom-prefix/${path}`;
        }
      }],
    ],
  },
});
 <testExecutions version="1">
-  <file path="test/fixtures/animals.test.ts">
+  <file path="custom-prefix/test/fixtures/animals.test.ts">
    <testCase name="animals - dogs say woof" duration="123" />
  </file>
</testExecutions>

What's Changed

Full Changelog: v1.0.0...v1.1.0