Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for rewriting <file path="..."> attributes #154

Merged
merged 1 commit into from
Feb 17, 2024

Conversation

AriPerkkio
Copy link
Owner

@AriPerkkio AriPerkkio commented Feb 4, 2024

Adds support for rewriting path attribute of file.

Example:

Original report:

<testExecutions version="1">
  <file path="test/fixtures/animals.test.ts">
    <testCase name="animals - dogs say woof" duration="123" />
  </file>
</testExecutions>
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 `frontend/${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>

@AriPerkkio AriPerkkio force-pushed the feat/on-write-path branch 2 times, most recently from 303dac3 to 049c9b8 Compare February 4, 2024 16:10
@AriPerkkio AriPerkkio force-pushed the feat/on-write-path branch 3 times, most recently from dd2abfb to 3ebe0f1 Compare February 17, 2024 08:33
@AriPerkkio AriPerkkio merged commit 998f5db into main Feb 17, 2024
6 checks passed
@AriPerkkio AriPerkkio deleted the feat/on-write-path branch February 17, 2024 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

adding ability to change reported root dir file path
1 participant