jest-coverage-report-action: Problems running only collect coverage
Hi, I’m trying to use our action just to collect my report and comment on github that information, but I can’t run successfully.
My action:
- name: Step 08 - Run Tests & Collect Coverage
run: |
echo “PATH_WAZUH-APP=$GITHUB_WORKSPACE/kibana/plugins/wazuh-kibana-app/” >> $GITHUB_ENV
cd ./kibana/plugins/wazuh-kibana-app
ls -la
echo $GITHUB_WORKSPACE/kibana/plugins/wazuh-kibana-app/
yarn run test:jest --silent --ci --testLocationInResults --colors --coverage --json --outputFile=report.json
- name: Step 09 - Comment coverage
uses: artiomtr/jest-coverage-report-action@v2.0-rc.1
with:
working-directory: ${{ env.PATH_WAZUH-APP }}
github-token: ${{ secrets.GITHUB_TOKEN }}
skip-step: all
Error result:
Run artiomtr/jest-coverage-report-action@v2.0-rc.1
with:
github-token: ***
skip-step: all
test-script: npx jest --silent --ci --coverage --testLocationInResults --json --outputFile="report.json"
icons: emoji
annotations: all
package-manager: npm
env:
“PATH_WAZUH-APP: /home/runner/work/wazuh-kibana-app/wazuh-kibana-app/kibana/plugins/wazuh-kibana-app/”
Could not read report file located at report.json [Error: ENOENT: no such file or directory, open 'report.json'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: 'report.json'
}
/usr/bin/git fetch --all --depth=1
fatal: not a git repository (or any of the parent directories): .git
Error fetching git repository Error: The process '/usr/bin/git' failed with exit code 128
at f._setResult (/home/runner/work/_actions/artiomtr/jest-coverage-report-action/v2.0-rc.1/dist/index.js:2:11470)
at f.CheckComplete (/home/runner/work/_actions/artiomtr/jest-coverage-report-action/v2.0-rc.1/dist/index.js:2:10900)
at ChildProcess.<anonymous> (/home/runner/work/_actions/artiomtr/jest-coverage-report-action/v2.0-rc.1/dist/index.js:2:9944)
at ChildProcess.emit (events.js:210:5)
at maybeClose (internal/child_process.js:1021:16)
at Socket.<anonymous> (internal/child_process.js:430:11)
at Socket.emit (events.js:210:5)
at Pipe.<anonymous> (net.js:659:12)
/usr/bin/git checkout -f 4.3-7.10
fatal: not a git repository (or any of the parent directories): .git
Error: The process '/usr/bin/git' failed with exit code 128
Here my action.yml
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (7 by maintainers)
@gabiwassan,
I think that the problem is that you’re changing directory in previous step, to collect coverage. You can try to simply remove
working-directory
option from youraction.yml
file, or just to exit working directory in previous step. So possible configurations could be:Also, if these configurations not solved your issue, try to remove step 8 and let this action collect coverage for you:
If these solutions do not help you, then wait until #118 is merged into the master.
Hello @gabiwassan! 👋
Sorry for the late reply. As far as I can see, in your configuration the
working-directory
has correct value, but it is not being passed to the action. I’m not sure, but it seems to me that the issue is with the name of the variable: try to rename it so that no hyphen is used (for examplePATH_WAZUH_APP
). If that doesn’t work, try running an action with a configuration like this:Hope my answer will help you!