Skip to content

Commit cc97d15

Browse files
committed
test: use vitest instead of jest
1 parent 1fbed51 commit cc97d15

File tree

34 files changed

+3140
-3773
lines changed

34 files changed

+3140
-3773
lines changed

.github/workflows/release.yml

Lines changed: 29 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -11,58 +11,50 @@ concurrency:
1111
cancel-in-progress: true
1212

1313
jobs:
14-
commitlint:
15-
name: CommitLint
14+
build-and-upload:
15+
name: Build and upload artifact
1616
runs-on: ubuntu-latest
17-
1817
steps:
19-
- name: Checkout client-application repository
20-
uses: actions/checkout@v3
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
- name: Install pnpm
21+
uses: pnpm/action-setup@v4
2122
with:
22-
fetch-depth: 0
23-
24-
- name: Set up Node.js
25-
uses: actions/setup-node@v3
23+
version: 9
24+
run_install: false
25+
- name: Install Node.js
26+
uses: actions/setup-node@v4
2627
with:
27-
node-version: 'latest'
28-
cache: 'yarn'
29-
28+
node-version: 22
29+
cache: 'pnpm'
3030
- name: Install dependencies
31-
run: yarn
32-
33-
- name: commitlint
34-
run: yarn lint.commit
35-
36-
build:
37-
uses: romain-cambonie/serenity-workflows/.github/workflows/_build-and-upload-artifact.reusable.yml@master
38-
with:
39-
out-dir: lib
40-
41-
validation:
42-
uses: romain-cambonie/serenity-workflows/.github/workflows/_validation-matrix.reusable.yml@master
43-
with:
44-
commands-as-comma-separated-string: 'lint.es,prettier.check,test'
31+
run: pnpm install
32+
- name: Build
33+
run: pnpm build
34+
- name: Upload build bundle as artifact
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: bundle
38+
path: |
39+
package.json
40+
lib
4541
4642
publish:
4743
name: Publish package to npm
4844
runs-on: ubuntu-latest
4945
needs:
5046
- build
51-
- validation
5247

5348
steps:
54-
- name: Checkout timetable-to-osm-opening-hours repository
55-
uses: actions/checkout@v3
49+
- name: Checkout repository
50+
uses: actions/checkout@v4
51+
- name: Install Node.js
52+
uses: actions/setup-node@v4
5653
with:
57-
fetch-depth: 0
58-
59-
- name: Set up Node.js
60-
uses: actions/setup-node@v3
61-
with:
62-
node-version: 'lts/*'
63-
54+
node-version: 22
55+
cache: 'pnpm'
6456
- name: Download release artifact
65-
uses: actions/download-artifact@v3
57+
uses: actions/download-artifact@v4
6658
with:
6759
name: bundle
6860

.github/workflows/validate.yml

Lines changed: 95 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,109 @@ concurrency:
2222
cancel-in-progress: true
2323

2424
jobs:
25+
prettier:
26+
name: Prettier
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
31+
- name: Install pnpm
32+
uses: pnpm/action-setup@v4
33+
with:
34+
version: 9
35+
run_install: false
36+
- name: Install Node.js
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: 22
40+
cache: 'pnpm'
41+
- name: Install dependencies
42+
run: pnpm install
43+
- name: Run Prettier check
44+
run: pnpm prettier.ci
45+
46+
eslint:
47+
name: ESLint
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Checkout repository
51+
uses: actions/checkout@v4
52+
- name: Install pnpm
53+
uses: pnpm/action-setup@v4
54+
with:
55+
version: 9
56+
run_install: false
57+
- name: Install Node.js
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version: 22
61+
cache: 'pnpm'
62+
- name: Install dependencies
63+
run: pnpm install
64+
- name: Run ESLint
65+
run: pnpm lint.es
66+
2567
commitlint:
2668
name: CommitLint
2769
runs-on: ubuntu-latest
28-
2970
steps:
30-
- name: Checkout client-application repository
31-
uses: actions/checkout@v3
71+
- name: Checkout repository
72+
uses: actions/checkout@v4
3273
with:
3374
fetch-depth: 0
34-
35-
- name: Set up Node.js
36-
uses: actions/setup-node@v3
75+
- name: Install pnpm
76+
uses: pnpm/action-setup@v4
3777
with:
38-
node-version: 'latest'
39-
cache: 'yarn'
40-
78+
version: 9
79+
run_install: false
80+
- name: Install Node.js
81+
uses: actions/setup-node@v4
82+
with:
83+
node-version: 22
84+
cache: 'pnpm'
4185
- name: Install dependencies
42-
run: yarn
86+
run: pnpm install
87+
- name: Run Commitlint
88+
run: pnpm lint.commit
4389

44-
- name: commitlint
45-
run: yarn lint.commit
90+
tests:
91+
name: Tests
92+
runs-on: ubuntu-latest
93+
steps:
94+
- name: Checkout repository
95+
uses: actions/checkout@v4
96+
- name: Install pnpm
97+
uses: pnpm/action-setup@v4
98+
with:
99+
version: 9
100+
run_install: false
101+
- name: Install Node.js
102+
uses: actions/setup-node@v4
103+
with:
104+
node-version: 22
105+
cache: 'pnpm'
106+
- name: Install dependencies
107+
run: pnpm install
108+
- name: Run Tests
109+
run: pnpm test
46110

47111
build:
48-
uses: romain-cambonie/serenity-workflows/.github/workflows/_build-and-upload-artifact.reusable.yml@master
49-
50-
validation-matrix:
51-
uses: romain-cambonie/serenity-workflows/.github/workflows/_validation-matrix.reusable.yml@master
52-
with:
53-
commands-as-comma-separated-string: 'lint.es,prettier.check,test'
112+
name: Build
113+
runs-on: ubuntu-latest
114+
steps:
115+
- name: Checkout repository
116+
uses: actions/checkout@v4
117+
- name: Install pnpm
118+
uses: pnpm/action-setup@v4
119+
with:
120+
version: 9
121+
run_install: false
122+
- name: Install Node.js
123+
uses: actions/setup-node@v4
124+
with:
125+
node-version: 22
126+
cache: 'pnpm'
127+
- name: Install dependencies
128+
run: pnpm install
129+
- name: Build
130+
run: pnpm build

.tooling/.jest/jest.config.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

.tsconfig/tsconfig.test.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://json.schemastore.org/tsconfig",
3-
"display": "Test configuration for Jest testing framework",
3+
"display": "Test configuration for Vitest testing framework",
44
"extends": "./tsconfig.base.json",
55
"include": ["../src/**/*.test.ts", "../src/**/*.spec.ts"]
66
}

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ La fusion sur la branche principale entraîne automatiquement la publication d'u
122122

123123
#### CLI
124124

125-
- [Jest](https://jestjs.io/) est une boîte à outils pour écrire des tests automatisés en JavaScript
125+
- [Vitest](https://vitest.dev/) est une boîte à outils pour écrire des tests automatisés en JavaScript
126126
- [Eslint](https://eslint.org/) est un analyseur statique de JavaScript
127127
- [Prettier](https://prettier.io/) est un magnificateur de code source en JavaScript
128128
- [Husky](https://typicode.github.io/husky/#/) est un outil qui permet d'effectuer des vérifications automatiques avant de publier des contributions.

package.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,30 +37,27 @@
3737
"lint.commit": "npx commitlint --from origin/main --config ./.tooling/.commitlint/commitlint.config.cjs",
3838
"lint-staged": "lint-staged --config=./.tooling/.lintstaged/.lintstagedrc",
3939
"prettier": "prettier --write ./src/",
40-
"prettier.check": "prettier --check ./src/",
41-
"test": "jest --config=./.tooling/.jest/jest.config.ts",
40+
"prettier.ci": "prettier --check ./src/",
41+
"test": "vitest",
4242
"build.commonjs": "tsc -p ./.tsconfig/tsconfig.cjs.json",
4343
"build.esm": "tsc -p ./.tsconfig/tsconfig.esm.json",
44-
"build": "yarn build.commonjs && yarn build.esm"
44+
"build": "pnpm build.commonjs && pnpm build.esm"
4545
},
4646
"devDependencies": {
4747
"@commitlint/cli": "^19.6.1",
4848
"@commitlint/config-conventional": "^19.6.0",
4949
"@eslint/js": "^9.17.0",
50-
"@types/jest": "^29.1.1",
5150
"@types/node": "^22.10.2",
5251
"@typescript-eslint/eslint-plugin": "^8.18.1",
5352
"@typescript-eslint/parser": "^8.18.1",
5453
"concurrently": "^9.1.0",
5554
"eslint": "^9.17.0",
5655
"eslint-config-prettier": "^9.1.0",
57-
"eslint-plugin-jest": "^28.10.0",
5856
"globals": "^15.14.0",
5957
"husky": "^9.1.7",
60-
"jest": "^29.1.2",
58+
"vitest": "^2.1.8",
6159
"lint-staged": "^15.2.11",
6260
"prettier": "3.4.2",
63-
"ts-jest": "^29.0.3",
6461
"ts-node": "^10.9.1",
6562
"typescript": "^5.7.2",
6663
"typescript-eslint": "^8.18.1"

0 commit comments

Comments
 (0)