diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index a34a9a8f7..b492877aa 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -16,10 +16,22 @@ env: jobs: build: + permissions: + checks: write + pull-requests: write + contents: write runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: ./.github/actions/setup-project + - uses: jwalton/gh-find-current-pr@v1 + id: findPr + - uses: ArtiomTr/jest-coverage-report-action@v2 + with: + test-script: npm test + output: report-markdown + annotations: failed-tests + prnumber: ${{ steps.findPr.outputs.number }} - name: Run style checks run: pipenv run flake8 . - name: Check imports alphabetized diff --git a/.gitignore b/.gitignore index 80dea872f..f01baa32a 100644 --- a/.gitignore +++ b/.gitignore @@ -71,6 +71,7 @@ htmlcov/ .coverage.* .cache .pytest_cache +coverage/ coverage.xml test_results.xml *,cover diff --git a/tests/javascripts/jest.config.js b/tests/javascripts/jest.config.js index aaeb00d8e..6b649f57f 100644 --- a/tests/javascripts/jest.config.js +++ b/tests/javascripts/jest.config.js @@ -1,7 +1,17 @@ module.exports = { + collectCoverage: true, + coverageDirectory: './coverage', + coverageThreshold: { + global: { + branches: 75, + functions: 90, + lines: 90, + statements: 90, + } + }, setupFiles: ['./support/setup.js'], testEnvironment: 'jsdom', testEnvironmentOptions: { url: 'https://www.notifications.service.gov.uk', }, -} +};