How to show relative path to the root directory on the details section? #314
Unanswered
edumserrano
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When I run my tests, the html report shows an absolute path for the tests under the details section. It looks like this:
What I would like is that the path to the test files was a relative path instead of absolute. I couldn't find any way to configure this in the
jest-html-reporters
. Looking through the source code it seems that the reporter will use whatever is theTestResult.testFilePath
which comes fromjest
.The way I got this to work for me was to create a custom reporter that runs before the
jest-html-reporters
and have my custom reporter update theTestResult.testFilePath
to the value I want. Here's how the custom reporter looks like:The reporters configuration on the jest configuration file looks like this:
And with the above I get the test file path as I wanted in the html report:
Is there a simpler way to achieve this?
Beta Was this translation helpful? Give feedback.
All reactions