diff --git a/.github/scripts/check-coverage-thresholds.js b/.github/scripts/check-coverage-thresholds.js index 6eb7a39e7..02c3995fd 100644 --- a/.github/scripts/check-coverage-thresholds.js +++ b/.github/scripts/check-coverage-thresholds.js @@ -1,5 +1,4 @@ const fs = require('fs'); -const { execSync } = require('child_process'); const coverage = require('../../coverage/coverage-summary.json'); const jestConfig = require('../../jest.config.js'); @@ -41,7 +40,6 @@ for (const key of ['branches', 'functions', 'lines', 'statements']) { if (failed) { const stars = '*'.repeat(warnMessage.length + 8); - execSync('clear', { stdio: 'inherit' }); console.log('\n\nCongratulations! You have successfully run the coverage check and added tests.'); console.log('\n\nThe jest.config.js file is not insync with your new test additions.'); console.log('Please update the coverage thresholds in jest.config.js.'); diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7e41d3893..75fc25cd7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,11 +5,29 @@ on: branches: ['*'] # or change to match your default branch push: branches: ['*'] + workflow_dispatch: jobs: test: runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: 22.13.1 + + - name: Install dependencies + run: npm ci + + - name: Run Jest tests + run: npm run ci:test + test-coverage: + runs-on: ubuntu-latest + steps: - name: Checkout code uses: actions/checkout@v3 @@ -23,7 +41,27 @@ jobs: run: npm ci - name: Run Jest tests with coverage - run: npm run ci + run: npm run ci:test:coverage - name: Check coverage thresholds run: npm run test:check-coverage-thresholds + lint: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: 22.13.1 + + - name: Install dependencies + run: npm ci + + - name: Run linting + run: npm run lint + + - name: Check formatting with prettier + run: npm run format:check diff --git a/package.json b/package.json index 63ec17e4b..9d0b3e1b9 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "ng": "ng", "analyze-bundle": "ng build --configuration=analyze-bundle && source-map-explorer dist/**/*.js --no-border-checks", "build": "ng build", - "ci": "npm run lint && jest --coverage", + "ci:test": "jest", + "ci:test:coverage": "jest --coverage", "docs": "./node_modules/.bin/compodoc -p tsconfig.docs.json --name 'OSF Angular Documentation' --theme 'laravel' -s", "docs:coverage": "./node_modules/.bin/compodoc -p tsconfig.docs.json --coverageTest 0 --coverageMinimumPerFile 0", "lint": "ng lint",