Skip to content

chore: migrate unit tests to vitest #695

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

Merged
merged 1 commit into from
May 16, 2025
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
46 changes: 23 additions & 23 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,26 @@ jobs:
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: dist/angular-intl-demo/browser

report-coverage:
concurrency: ci-${{ github.ref }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false

- name: install
run: pnpm install --frozen-lockfile

- name: test
run: pnpm test --watch=false --browsers=ChromeHeadless

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# ToDo: investigate coverage reporting
# report-coverage:
# concurrency: ci-${{ github.ref }}
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
#
# - uses: pnpm/action-setup@v4
# name: Install pnpm
# with:
# run_install: false
#
# - name: install
# run: pnpm install --frozen-lockfile
#
# - name: test
# run: pnpm test --watch=false --browsers=ChromeHeadless
#
# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v5
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
56 changes: 32 additions & 24 deletions .github/workflows/verify-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,17 @@ jobs:
- name: install
run: pnpm install --frozen-lockfile

- name: Install Playwright Browsers
run: npx playwright install --with-deps

- name: test
run: pnpm test --watch=false --browsers=ChromeHeadless
run: pnpm test --browsers=chromium

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# ToDo: investigate coverage reporting
# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v5
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

test-firefox:
runs-on: ubuntu-latest
Expand All @@ -87,27 +91,31 @@ jobs:
- name: install
run: pnpm install --frozen-lockfile

- name: test
run: pnpm test --watch=false --browsers=FirefoxHeadless

test-safari:
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false

- name: install
run: pnpm install --frozen-lockfile
- name: Install Playwright Browsers
run: npx playwright install --with-deps

- name: test
run: pnpm test --watch=false --browsers=SafariNative
run: pnpm test --browsers=firefox

# ToDo: investigate errors & enable Safari testing again
# test-safari:
# runs-on: macos-14
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# ref: refs/pull/${{ github.event.pull_request.number }}/merge
#
# - uses: pnpm/action-setup@v4
# name: Install pnpm
# with:
# run_install: false
#
# - name: install
# run: pnpm install --frozen-lockfile
#
# - name: test
# run: pnpm test --watch=false --browsers=SafariNative

prettier:
runs-on: ubuntu-latest
Expand Down
11 changes: 7 additions & 4 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@
"defaultConfiguration": "production"
},
"test": {
"builder": "@angular/build:karma",
"builder": "@angular/build:unit-test",
"options": {
"tsConfig": "projects/angular-ecmascript-intl/tsconfig.spec.json",
"polyfills": ["zone.js", "zone.js/testing"],
"karmaConfig": "projects/angular-ecmascript-intl/karma.conf.js"
"buildTarget": "angular-ecmascript-intl:build",
"browsers": ["chromium"],
"reporters": ["default", "junit"],
"runner": "vitest",
"providersFile": "projects/angular-ecmascript-intl/src/providers.ts",
"tsConfig": "projects/angular-ecmascript-intl/tsconfig.spec.json"
}
}
}
Expand Down
52 changes: 22 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build-lib": "cpy README.md projects/angular-ecmascript-intl && ng build angular-ecmascript-intl",
"build-app": "ng build angular-intl-demo",
"watch": "ng build --watch --configuration development",
"test": "ng test --code-coverage=true",
"test": "ng test",
"lint": "eslint .",
"release": "release-it",
"prettier": "prettier . --write"
Expand All @@ -24,47 +24,39 @@
"@angular/platform-browser": "20.0.0-rc.1",
"@angular/platform-browser-dynamic": "20.0.0-rc.1",
"@angular/router": "20.0.0-rc.1",
"marked": "^15.0.0",
"ngx-markdown": "^19.0.0",
"prismjs": "^1.29.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"marked": "^15.0.11",
"ngx-markdown": "^19.1.1",
"prismjs": "^1.30.0",
"rxjs": "~7.8.2",
"tslib": "^2.8.1",
"zone.js": "~0.15.0"
},
"devDependencies": {
"@angular/build": "20.0.0-rc.2",
"@angular/cli": "20.0.0-rc.2",
"@angular/compiler-cli": "20.0.0-rc.1",
"@eslint/js": "^9.2.0",
"@types/jasmine": "~5.1.0",
"angular-eslint": "^19.0.0-alpha.4",
"@eslint/js": "^9.26.0",
"@types/node": "^22.15.18",
"@vitest/browser": "^3.1.3",
"@vitest/coverage-v8": "^3.1.3",
"angular-eslint": "^19.4.0",
"cpy-cli": "^5.0.0",
"dayjs": "^1.11.7",
"eslint": "^9.0.0",
"globals": "^16.0.0",
"jasmine-core": "~5.7.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-firefox-launcher": "^2.1.2",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"karma-safarinative-launcher": "^1.1.0",
"ng-packagr": "~20.0.0-next.8",
"prettier": "~3.5.0",
"prettier-plugin-organize-imports": "^4.0.0",
"typescript": "~5.8.0",
"typescript-eslint": "^8.0.0"
"dayjs": "^1.11.13",
"eslint": "^9.26.0",
"globals": "^16.1.0",
"jsdom": "^26.1.0",
"ng-packagr": "20.0.0-rc.0",
"playwright": "^1.52.0",
"prettier": "~3.5.3",
"prettier-plugin-organize-imports": "^4.1.0",
"typescript": "~5.8.3",
"typescript-eslint": "^8.32.1",
"vitest": "^3.1.3"
},
"engines": {
"npm": "Please use pnpm instead of npm to install dependencies",
"yarn": "Please use pnpm instead of yarn to install dependencies",
"pnpm": "^10.7.0"
},
"pnpm": {
"overrides": {
"jasmine-core": "$jasmine-core"
}
},
"packageManager": "[email protected]"
}
Loading
Loading