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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
17 changes: 0 additions & 17 deletions .github/counter/counter.test.display.js

This file was deleted.

22 changes: 0 additions & 22 deletions .github/counter/counter.test.increment.js

This file was deleted.

14 changes: 6 additions & 8 deletions .github/scripts/check-coverage-thresholds.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
const fs = require('fs');
const coverage = require('../../coverage/coverage-summary.json');
const jestConfig = require('../../jest.config.js');
const vitestConfig = require('../../vitest.config.ts');

const summary = coverage.total;
const thresholds = jestConfig.coverageThreshold.global;
const thresholds = vitestConfig.default.test.coverage.thresholds;

let failed = false;
const errors = [];
Expand All @@ -29,7 +28,7 @@ for (const key of ['branches', 'functions', 'lines', 'statements']) {
);
errors.push(
formatErrorsWithAlignedStars(
`Please update the coverageThreshold.global.${key} in the jest.config.js to ---> ${current} <---`,
`Please update test.coverage.thresholds.${key} in vitest.config.ts to ---> ${current} <---`,
true
)
);
Expand All @@ -41,9 +40,9 @@ for (const key of ['branches', 'functions', 'lines', 'statements']) {
if (failed) {
const stars = '*'.repeat(warnMessage.length + 8);
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.');
console.log('You will need to commit again once you have updated the jst.config.js file.');
console.log('\n\nThe vitest.config.ts file is not in sync with your new test additions.');
console.log('Please update test.coverage.thresholds in vitest.config.ts.');
console.log('You will need to commit again once you have updated the vitest.config.ts file.');
console.log('This is only necessary until we hit 100% coverage.');
console.log(`\n\n${stars}`);
errors.forEach((err) => {
Expand All @@ -55,5 +54,4 @@ if (failed) {
console.log(`${leftBracket}${warnMessage}${rightBracket}`);
console.log(`${leftBracket}${' '.repeat(warnMessage.length)}${rightBracket}`);
console.log(`${stars}\n\n`);
// process.exit(1);
}
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run Jest Tests
name: Run Vitest Tests

on:
pull_request:
Expand Down Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Run Jest tests
- name: Run Vitest tests
run: npm run ci:test
test-coverage:
runs-on: ubuntu-latest
Expand All @@ -43,7 +43,7 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Run Jest tests with coverage
- name: Run Vitest tests with coverage
run: npm run ci:test:coverage

- name: Check coverage thresholds
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ yarn-error.log
/libpeerconnection.log
testem.log
/typings
/public

# System files
.DS_Store
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

We follow the CalVer (https://calver.org/) versioning scheme: YY.MINOR.MICRO.

26.8.0 (2026-04-16)
===================

* Angular upgrade

26.7.0 (2026-04-08)
===================

Expand Down
19 changes: 8 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,23 @@ take up to 60 seconds once the docker build finishes.

## Testing the project

The project uses jest for unit testing.
A "counter" script executes before and after each test run to track how many times the unit
tests are run locally. The output is displayed.
The project uses Vitest through Angular's unit test builder (`ng test`).
A "counter" script displays local run stats after coverage runs.

```bash
npm run test (single test run)
npm run test:watch (single run after file save)
npm run test:coverage (code coverage results)
npm run test # single test run (no watch)
npm run test:one "src/path/to/file.spec.ts" # run one spec file
npm run test:watch # watch mode
npm run test:coverage # coverage reports
```

- all commits must pass the local pipeline for test coverage
Coverage thresholds are configured in `vitest.config.ts` (`test.coverage.thresholds`).
To validate threshold updates after improving coverage:

```bash
npm run test:check-coverage-thresholds
```

- Verifies newly added tests match the thresholds
- This is only used until we hit 100% test coverage
- all commits must pass the local pipeline for test coverage

## Volta

OSF uses volta to manage node and npm versions inside of the repository
Expand Down
26 changes: 18 additions & 8 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@
"prefix": "osf",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:application",
"builder": "@angular/build:application",
"options": {
"outputPath": "dist/osf",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"allowedCommonJsDependencies": [
Expand Down Expand Up @@ -68,6 +67,9 @@
"outputMode": "server",
"ssr": {
"entry": "src/server.ts"
},
"security": {
"allowedHosts": ["localhost", "127.0.0.1"]
}
},
"configurations": {
Expand Down Expand Up @@ -168,7 +170,7 @@
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"builder": "@angular/build:dev-server",
"options": {
"hmr": false
},
Expand Down Expand Up @@ -197,13 +199,21 @@
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n"
},
"test": {
"builder": "@angular-devkit/build-angular:jest",
"builder": "@angular/build:unit-test",
"options": {
"tsConfig": "tsconfig.spec.json"
"runnerConfig": "vitest.config.ts",
"coverageInclude": ["src/app/**/*.ts"],
"coverageExclude": [
"src/main.ts",
"src/app/app.{config,routes}.ts",
"**/theme/*.ts",
"**/*.{routes,server}.ts",
"**/index.ts",
"**/mappers/**",
"**/constants/**",
"**/*.{enum,model,type,interface}.ts"
]
}
},
"lint": {
Expand Down
1 change: 0 additions & 1 deletion docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ If the application does not open in your browser at [http://localhost:4200](http
This should return something like `0.0.0.0:4200` or `127.0.0.1:4200`.

6. **Bypass browser caching issues**

- Open the site in an incognito/private window.
- Or test with:
```bash
Expand Down
2 changes: 0 additions & 2 deletions docs/git-convention.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ The local pipeline is managed via husky
To contribute to this repository, follow these steps:

1. **Fork the Repository**

- Go to the main repository page on GitHub [OSF Angular Project](https://github.com/CenterForOpenScience/angular-osf).
- Click the **Fork** button (top-right corner).
- This creates a copy of the repository under your GitHub account.
Expand All @@ -56,7 +55,6 @@ To contribute to this repository, follow these steps:
```

4. **Make Your Changes**

- Follow the commit conventions outlined below.
- Ensure all tests pass before committing.

Expand Down
Loading
Loading