Skip to content

Commit 650273a

Browse files
committed
chore: migrate unit tests to vitest
1 parent 97b2f07 commit 650273a

19 files changed

+954
-931
lines changed

.github/workflows/build-and-deploy.yml

+23-23
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,26 @@ jobs:
3030
uses: JamesIves/github-pages-deploy-action@v4
3131
with:
3232
folder: dist/angular-intl-demo/browser
33-
34-
report-coverage:
35-
concurrency: ci-${{ github.ref }}
36-
runs-on: ubuntu-latest
37-
steps:
38-
- name: Checkout
39-
uses: actions/checkout@v4
40-
41-
- uses: pnpm/action-setup@v4
42-
name: Install pnpm
43-
with:
44-
run_install: false
45-
46-
- name: install
47-
run: pnpm install --frozen-lockfile
48-
49-
- name: test
50-
run: pnpm test --watch=false --browsers=ChromeHeadless
51-
52-
- name: Upload coverage reports to Codecov
53-
uses: codecov/codecov-action@v5
54-
env:
55-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
33+
# ToDo: investigate coverage reporting
34+
# report-coverage:
35+
# concurrency: ci-${{ github.ref }}
36+
# runs-on: ubuntu-latest
37+
# steps:
38+
# - name: Checkout
39+
# uses: actions/checkout@v4
40+
#
41+
# - uses: pnpm/action-setup@v4
42+
# name: Install pnpm
43+
# with:
44+
# run_install: false
45+
#
46+
# - name: install
47+
# run: pnpm install --frozen-lockfile
48+
#
49+
# - name: test
50+
# run: pnpm test --watch=false --browsers=ChromeHeadless
51+
#
52+
# - name: Upload coverage reports to Codecov
53+
# uses: codecov/codecov-action@v5
54+
# env:
55+
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/verify-build.yml

+32-24
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,17 @@ jobs:
6363
- name: install
6464
run: pnpm install --frozen-lockfile
6565

66+
- name: Install Playwright Browsers
67+
run: npx playwright install --with-deps
68+
6669
- name: test
67-
run: pnpm test --watch=false --browsers=ChromeHeadless
70+
run: pnpm test --browsers=chromium
6871

69-
- name: Upload coverage reports to Codecov
70-
uses: codecov/codecov-action@v5
71-
env:
72-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
72+
# ToDo: investigate coverage reporting
73+
# - name: Upload coverage reports to Codecov
74+
# uses: codecov/codecov-action@v5
75+
# env:
76+
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
7377

7478
test-firefox:
7579
runs-on: ubuntu-latest
@@ -87,27 +91,31 @@ jobs:
8791
- name: install
8892
run: pnpm install --frozen-lockfile
8993

90-
- name: test
91-
run: pnpm test --watch=false --browsers=FirefoxHeadless
92-
93-
test-safari:
94-
runs-on: macos-14
95-
steps:
96-
- name: Checkout
97-
uses: actions/checkout@v4
98-
with:
99-
ref: refs/pull/${{ github.event.pull_request.number }}/merge
100-
101-
- uses: pnpm/action-setup@v4
102-
name: Install pnpm
103-
with:
104-
run_install: false
105-
106-
- name: install
107-
run: pnpm install --frozen-lockfile
94+
- name: Install Playwright Browsers
95+
run: npx playwright install --with-deps
10896

10997
- name: test
110-
run: pnpm test --watch=false --browsers=SafariNative
98+
run: pnpm test --browsers=firefox
99+
100+
# ToDo: investigate errors & enable Safari testing again
101+
# test-safari:
102+
# runs-on: macos-14
103+
# steps:
104+
# - name: Checkout
105+
# uses: actions/checkout@v4
106+
# with:
107+
# ref: refs/pull/${{ github.event.pull_request.number }}/merge
108+
#
109+
# - uses: pnpm/action-setup@v4
110+
# name: Install pnpm
111+
# with:
112+
# run_install: false
113+
#
114+
# - name: install
115+
# run: pnpm install --frozen-lockfile
116+
#
117+
# - name: test
118+
# run: pnpm test --watch=false --browsers=SafariNative
111119

112120
prettier:
113121
runs-on: ubuntu-latest

angular.json

+7-4
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,14 @@
2525
"defaultConfiguration": "production"
2626
},
2727
"test": {
28-
"builder": "@angular/build:karma",
28+
"builder": "@angular/build:unit-test",
2929
"options": {
30-
"tsConfig": "projects/angular-ecmascript-intl/tsconfig.spec.json",
31-
"polyfills": ["zone.js", "zone.js/testing"],
32-
"karmaConfig": "projects/angular-ecmascript-intl/karma.conf.js"
30+
"buildTarget": "angular-ecmascript-intl:build",
31+
"browsers": ["chromium"],
32+
"reporters": ["default", "junit"],
33+
"runner": "vitest",
34+
"providersFile": "projects/angular-ecmascript-intl/src/providers.ts",
35+
"tsConfig": "projects/angular-ecmascript-intl/tsconfig.spec.json"
3336
}
3437
}
3538
}

package.json

+22-30
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"build-lib": "cpy README.md projects/angular-ecmascript-intl && ng build angular-ecmascript-intl",
99
"build-app": "ng build angular-intl-demo",
1010
"watch": "ng build --watch --configuration development",
11-
"test": "ng test --code-coverage=true",
11+
"test": "ng test",
1212
"lint": "eslint .",
1313
"release": "release-it",
1414
"prettier": "prettier . --write"
@@ -24,47 +24,39 @@
2424
"@angular/platform-browser": "20.0.0-rc.1",
2525
"@angular/platform-browser-dynamic": "20.0.0-rc.1",
2626
"@angular/router": "20.0.0-rc.1",
27-
"marked": "^15.0.0",
28-
"ngx-markdown": "^19.0.0",
29-
"prismjs": "^1.29.0",
30-
"rxjs": "~7.8.0",
31-
"tslib": "^2.3.0",
27+
"marked": "^15.0.11",
28+
"ngx-markdown": "^19.1.1",
29+
"prismjs": "^1.30.0",
30+
"rxjs": "~7.8.2",
31+
"tslib": "^2.8.1",
3232
"zone.js": "~0.15.0"
3333
},
3434
"devDependencies": {
3535
"@angular/build": "20.0.0-rc.2",
3636
"@angular/cli": "20.0.0-rc.2",
3737
"@angular/compiler-cli": "20.0.0-rc.1",
38-
"@eslint/js": "^9.2.0",
39-
"@types/jasmine": "~5.1.0",
40-
"angular-eslint": "^19.0.0-alpha.4",
38+
"@eslint/js": "^9.26.0",
39+
"@types/node": "^22.15.18",
40+
"@vitest/browser": "^3.1.3",
41+
"@vitest/coverage-v8": "^3.1.3",
42+
"angular-eslint": "^19.4.0",
4143
"cpy-cli": "^5.0.0",
42-
"dayjs": "^1.11.7",
43-
"eslint": "^9.0.0",
44-
"globals": "^16.0.0",
45-
"jasmine-core": "~5.7.0",
46-
"karma": "~6.4.0",
47-
"karma-chrome-launcher": "~3.2.0",
48-
"karma-coverage": "~2.2.0",
49-
"karma-firefox-launcher": "^2.1.2",
50-
"karma-jasmine": "~5.1.0",
51-
"karma-jasmine-html-reporter": "~2.1.0",
52-
"karma-safarinative-launcher": "^1.1.0",
53-
"ng-packagr": "~20.0.0-next.8",
54-
"prettier": "~3.5.0",
55-
"prettier-plugin-organize-imports": "^4.0.0",
56-
"typescript": "~5.8.0",
57-
"typescript-eslint": "^8.0.0"
44+
"dayjs": "^1.11.13",
45+
"eslint": "^9.26.0",
46+
"globals": "^16.1.0",
47+
"jsdom": "^26.1.0",
48+
"ng-packagr": "20.0.0-rc.0",
49+
"playwright": "^1.52.0",
50+
"prettier": "~3.5.3",
51+
"prettier-plugin-organize-imports": "^4.1.0",
52+
"typescript": "~5.8.3",
53+
"typescript-eslint": "^8.32.1",
54+
"vitest": "^3.1.3"
5855
},
5956
"engines": {
6057
"npm": "Please use pnpm instead of npm to install dependencies",
6158
"yarn": "Please use pnpm instead of yarn to install dependencies",
6259
"pnpm": "^10.7.0"
6360
},
64-
"pnpm": {
65-
"overrides": {
66-
"jasmine-core": "$jasmine-core"
67-
}
68-
},
6961
"packageManager": "[email protected]"
7062
}

0 commit comments

Comments
 (0)