Skip to content

AB-454: Setup coverage report and send to looker #847

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

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,15 @@ jobs:
- run: npm ci
- run: npm run test-lint
- run: npm run test-system
- run: npm run test-unit

- run: npm run test-unit | tee coverage.txt && exit ${PIPESTATUS[0]}
- name: Upload coverage-summary.json
if: matrix.node-version == '22.x'
uses: actions/upload-artifact@v4
with:
name: coverage-summary-unit
path: |
.coverage/coverage-summary.json
coverage.txt
Regression:
needs: Unit-Tests
runs-on: ubuntu-latest
Expand All @@ -35,4 +42,12 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run test-regression
- run: npm run test-regression | tee coverage.txt && exit ${PIPESTATUS[0]}
- name: Upload coverage-summary.json
if: matrix.node-version == '22.x'
uses: actions/upload-artifact@v4
with:
name: coverage-summary-integration
path: |
.coverage/coverage-summary.json
coverage.txt
52 changes: 52 additions & 0 deletions .github/workflows/test-infra-scripts-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# owned by test infrastructure team
name: 'Quality Check Action'

on:
pull_request:
push:
branches:
- main

env:
GITHUB_BRANCH: ${{ github.head_ref || github.ref_name }}
GH_TOKEN: ${{ github.token }}
GH_BASE_SHA: ${{ github.event.pull_request.base.sha }}
GH_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
GITHUB_REPOSITORY: ${{ github.repository }}

jobs:
track-unit-test-coverage:
runs-on: ubuntu-latest
steps:
- name: Track unit-test coverage
uses: postmanlabs/test-infra-scripts/.github/actions/coverage-pr-comment-action@main
with:
jobName: 'Unit-Tests'
coverageType: unit
squad: api-builder
artifactSource: coverage-summary-unit
sonarqube_check: false
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
QE_HEVO_WEBHOOK_URL: ${{ secrets.QE_HEVO_WEBHOOK_URL }}
QE_HEVO_ACCESS_KEY: ${{ secrets.QE_HEVO_ACCESS_KEY }}
QE_HEVO_SECRET_KEY: ${{ secrets.QE_HEVO_SECRET_KEY }}
POSTMAN_NPM_TOKEN: ${{ secrets.POSTMAN_NPM_TOKEN }}

track-integration-test-coverage:
runs-on: ubuntu-latest
steps:
- name: Track integration-test coverage
uses: postmanlabs/test-infra-scripts/.github/actions/coverage-pr-comment-action@main
with:
jobName: 'Regression'
coverageType: integration
squad: api-builder
artifactSource: coverage-summary-integration
sonarqube_check: false
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
QE_HEVO_WEBHOOK_URL: ${{ secrets.QE_HEVO_WEBHOOK_URL }}
QE_HEVO_ACCESS_KEY: ${{ secrets.QE_HEVO_ACCESS_KEY }}
QE_HEVO_SECRET_KEY: ${{ secrets.QE_HEVO_SECRET_KEY }}
POSTMAN_NPM_TOKEN: ${{ secrets.POSTMAN_NPM_TOKEN }}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@
},
"scripts": {
"test": "./scripts/test.sh",
"test-unit": "nyc --reporter=text -x **/assets/** -x **/test/** ./node_modules/mocha/bin/mocha --timeout 90000 \"test/unit/**/**.test.js\"",
"test-unit": "nyc --reporter=text --reporter=json-summary --report-dir=.coverage -x **/assets/** -x **/test/** ./node_modules/mocha/bin/mocha --timeout 90000 \"test/unit/**/**.test.js\"",
"test-lint": "./scripts/test-lint.sh",
"test-system": "./node_modules/mocha/bin/mocha -x **/assets/** -x **/test/** \"test/system/**.test.js\"",
"test-regression": "./node_modules/mocha/bin/mocha test/integration/integration.test.js test/unit/sanity.test.js",
"test-regression": "nyc --reporter=text --reporter=json-summary --report-dir=.coverage ./node_modules/mocha/bin/mocha test/integration/integration.test.js test/unit/sanity.test.js",
Comment on lines +153 to +156
Copy link
Preview

Copilot AI Jun 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The test-unit and test-regression scripts share many flags; consider extracting common NYC options into a reusable npm script or a configuration file to reduce duplication.

Copilot uses AI. Check for mistakes.

"release": "./scripts/release.sh",
"coverage": "nyc report --reporter=html --reporter=text mocha"
}
Expand Down
Loading