Skip to content

Commit

Permalink
add step to ensure junit output directory exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac Boyd committed Jul 23, 2024
1 parent 0196baa commit 7ffb953
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/actions/build-and-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,28 @@ runs:
run: yarn build
shell: bash

- name: Create test reports directory
run: mkdir -p ./test-reports/jest
shell: bash

- name: Find and run test files
run: |
TESTFILES=$(find lib -name '*.spec.ts')
for file in $TESTFILES; do
filename=$(basename "$file" .spec.ts)
JEST_JUNIT_OUTPUT_NAME="${{ github.sha }}_node${{ inputs.node_version }}_${filename}_results.xml" \
yarn test $file --ci --reporters=default --reporters=jest-junit
done
env:
JEST_JUNIT_OUTPUT_DIR: ./test-reports/jest
JEST_JUNIT_OUTPUT_NAME: ${{ github.sha }}_node${{ inputs.node_version }}_${filename}_results.xml
JEST_JUNIT_CLASSNAME: "{filepath}"
JEST_JUNIT_UNIQUE_OUTPUT_NAME: "true"
shell: bash

- name: Test summary
uses: test-summary/action@v2
with:
paths: ./test-reports/jest/${{ github.sha }}_node${{ inputs.node_version }}_${filename}_results.xml
paths: ./test-reports/jest/${{ github.sha }}_node${{ inputs.node_version }}_*_results.xml

- name: Upload Artifact
uses: actions/upload-artifact@v4
Expand Down

0 comments on commit 7ffb953

Please sign in to comment.