Closed TobiasGoetz closed 1 year ago
I don't succeed to reproduce the issue, can you please share it with me:
uses: MishaKav/jest-coverage-comment@main
xxx
)all settings that you pass to uses: MishaKav/jest-coverage-comment@main
My workflow includes the following step for generating the comment
- name: Jest Coverage Comment
uses: MishaKav/jest-coverage-comment@main
with:
coverage-summary-path: ./coverage/coverage-summary.json
coverage-path: ./coverage.txt
junitxml-path: ./coverage/junit.xml
title: Test Summary
summary-title: Summary
junitxml-title: Unit Tests
do you know if the link to the file works? or it doesn't work either?
The link to the file doesn't work either.
can you share with me the generated link for some lines? (you can replace the sensitive data if you want with some xxx)
Link to the file: https://github.com/xxx/xxx/blob/e461ec8da9e75b57b81231ccf647baa300b9b6e5/xxx/app.js
Link to the lines: https://github.com/xxx/xxx/blob/e461ec8da9e75b57b81231ccf647baa300b9b6e5/xxx/routes/business.js#L79
I forgot to mention that I am running this in a private organization repo and not my private one. Don't know if that may influence the result at all.
app.js
? (what should be instead xxx
before the app.js
., it some directory? maybe some prefix?
this how simple link to some of current repo file looks like https://github.com/MishaKav/jest-coverage-comment/blob/d12e14b4f20d7075892280420157193cae774e08/package.json
xxx
stands for the organization namexxx
stands for the repository namexxx
stands for the repository name (again)The issue seems to be the last(third) xxx
.
When I remove that one the link works.
yes, looks like this is the problem, the action already supports this kind of problem.
You just need to path the prefix directory coverage-path-prefix
:
- name: Jest Coverage Comment
uses: MishaKav/jest-coverage-comment@main
with:
# your cofings....
coverage-path-prefix: XXX
Hi @MishaKav, thanks for your response.
My issue is that there is a repository name too much at the end. The last xxx in the link (repository name) has to be removed to make it valid. Is it possible to remove part of the link with the coverage-path-prefix setting or only add additional?
sure, you can use the coverage-path-prefix
as the regular shell command. To remove some directories use ../
before.
Hi @MishaKav, it's been a few days and I finally came to test the coverage-path-prefix but it seems to cut off the wrong part.
I added following code to the action
coverage-path-prefix: '../'
Now it cuts of the blob and not the repo, thus it still doesn't work correctly.
Before: https://github.com/[ORG]/[REPO]/blob/599f3XXXd2b9a/[REPO2]/helper/validator.js
After adding the prefix option: https://github.com/[ORG]/[REPO]/blob/[REPO2]/helper/validator.js
[ORG] := the organization name [REPO] := The repository name [REPO2] := The repository name XXX := placeholder for more letters and numbers
Is there a way to only remove [REPO2] from the url?
Can you try coverage-path-prefix: '../../'
?
Any update on this? I am also having this issue
Edit: Actually just figured out a way to get it to work for my case... Basically, my coverage report always includes coverage for the entire project, and so the line number links being based on the commit wasn't leading to the correct page. So I needed the links to include the branch name from the PR, which I managed to do by using:
coverage-path-prefix: ../${{ github.head_ref || github.ref_name }}/src/
Can you try
coverage-path-prefix: '../../'
?
Using ../../
redirects me to:
https://github.com/[ORG]/[REPO]/[REPO2]/helper/validator.js?rgh-link-date=2023-02-20T12%3A08%3A47Z
Edit: The issue is that i can't remove the [REPO2] by using the coverage-path-prefix.
Expected Behavior
Clicking the line numbers in the added comment shows lines not covered by tests in the code.
Current Behavior
Clicking on line numbers opens another github page but that says: "The repository doesn't contain the /file.js path in '6074679594'"
Steps to Reproduce
Screenshots