Skip to content
Merged
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
2 changes: 0 additions & 2 deletions .github/scripts/check-coverage-thresholds.js
Original file line number Diff line number Diff line change
@@ -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');

Expand Down Expand Up @@ -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.');
Expand Down
40 changes: 39 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to remain until the tests hit 100% coverage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it looks like jest --coverage already checks against the thresholds in jest.config.js -- see the run on main where tests pass but test-coverage fails https://github.com/aaxelb/angular-osf/actions/runs/17586931885/job/49957362973#step:5:220

(i got an error from the check-coverage-thresholds.js in ci (tho can't find the link now) and figured it was vibed more for the pre-push check)

Copy link
Contributor

Choose a reason for hiding this comment

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

It's for both.

Copy link
Contributor Author

@aaxelb aaxelb Sep 9, 2025

Choose a reason for hiding this comment

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

looks like it breaks (tested by added a tmp commit lowering thresholds on a main-based branch, so it can get that far) https://github.com/aaxelb/angular-osf/actions/runs/17593249589/job/49979054962#step:6:19

don't know node, but guessing clear only makes sense in an interactive shell -- removed that call from the script (edit: seems to work, ignoring stdout/stderr interleaving), tho feel free to add back if you figure out how to make it ci-friendly

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
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down