Skip to content

Commit d168f3e

Browse files
Copilotsetchy
andauthored
refactor: Migrate test framework from Jest to Vitest (#2216)
* Initial plan * Update dependencies and config files for Vitest migration Co-authored-by: setchy <[email protected]> * Convert all Jest APIs to Vitest APIs in test files Co-authored-by: setchy <[email protected]> * Remove old jest.config.ts file Co-authored-by: setchy <[email protected]> * Trigger push of previous commits Co-authored-by: setchy <[email protected]> * Complete Jest to Vitest migration Co-authored-by: setchy <[email protected]> * pin Signed-off-by: Adam Setch <[email protected]> * migrate to vitest Signed-off-by: Adam Setch <[email protected]> * lint fixes Signed-off-by: Adam Setch <[email protected]> * migrate to vitest Signed-off-by: Adam Setch <[email protected]> * Update README.md * migrate to vitest Signed-off-by: Adam Setch <[email protected]> * migrate to vitest Signed-off-by: Adam Setch <[email protected]> * migrate to vitest Signed-off-by: Adam Setch <[email protected]> * migrate to vitest Signed-off-by: Adam Setch <[email protected]> * migrate to vitest Signed-off-by: Adam Setch <[email protected]> * migrate to vitest Signed-off-by: Adam Setch <[email protected]> * migrate to vitest Signed-off-by: Adam Setch <[email protected]> * migrate to vitest Signed-off-by: Adam Setch <[email protected]> * migrate to vitest Signed-off-by: Adam Setch <[email protected]> * migrate to vitest Signed-off-by: Adam Setch <[email protected]> * migrate to vitest Signed-off-by: Adam Setch <[email protected]> * migrate to vitest Signed-off-by: Adam Setch <[email protected]> --------- Signed-off-by: Adam Setch <[email protected]> Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: setchy <[email protected]> Co-authored-by: Adam Setch <[email protected]>
1 parent 303c9d7 commit d168f3e

File tree

76 files changed

+2056
-2408
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+2056
-2408
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
run: pnpm tsc --noEmit
2222

2323
- name: Run tests with coverage
24-
run: pnpm test:coverage --verbose
24+
run: pnpm test
2525

2626
- name: Archive code coverage results
2727
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0

.vscode/extensions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"GraphQL.vscode-graphql",
77
"GraphQL.vscode-graphql-syntax",
88
"lokalise.i18n-ally",
9-
"SonarSource.sonarlint-vscode"
9+
"SonarSource.sonarlint-vscode",
10+
"vitest.explorer"
1011
]
1112
}

.vscode/settings.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,5 @@
1717
"i18n-ally.localesPaths": ["src/renderer/i18n/locales"],
1818
"i18n-ally.sourceLanguage": "en",
1919
"i18n-ally.keystyle": "nested",
20-
"i18n-ally.sortKeys": true,
21-
"jest.runMode": "on-save"
20+
"i18n-ally.sortKeys": true
2221
}

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ To reload the app with the changes that `pnpm watch` has detected, you can use t
3737

3838
There are 2 checks:
3939
1. linter & formatter with [biome][biome-website]
40-
2. unit tests with [jest][jest-website]
40+
2. unit tests with [vitest][vitest-website]
4141

4242
```shell
4343
# Run biome to check linting and formatting
@@ -46,7 +46,7 @@ pnpm lint:check
4646
# Run unit tests with coverage
4747
pnpm test
4848

49-
# Update jest snapshots
49+
# Update vitest snapshots
5050
pnpm test -u
5151
```
5252

@@ -87,5 +87,5 @@ To add new locales
8787
[github-new-milestone]: https://github.com/setchy/atlassify/milestones/new
8888
[github-new-release]: https://github.com/setchy/atlassify/releases/new
8989
[homebrew-cask-autobump-workflow]: https://github.com/Homebrew/homebrew-cask/actions/workflows/autobump.yml
90-
[jest-website]: https://jestjs.io/
90+
[vitest-website]: https://vitest.dev/
9191

jest.config.ts

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

package.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@
2020
"package:win": "electron-builder --win --config ./config/electron-builder.js",
2121
"lint:check": "biome check",
2222
"lint": "biome check --fix",
23-
"test": "jest",
24-
"test:watch": "jest --watch",
25-
"test:changed": "jest --onlyChanged",
26-
"test:coverage": "jest --coverage",
23+
"test": "vitest --coverage",
24+
"test:ui": "vitest --ui",
2725
"start": "electron . --enable-logging",
2826
"prepare": "husky",
2927
"codegen": "graphql-codegen --config codegen.ts"
@@ -103,11 +101,13 @@
103101
"@testing-library/react": "16.3.2",
104102
"@testing-library/user-event": "14.6.1",
105103
"@types/dotenv-webpack": "7.0.8",
106-
"@types/jest": "30.0.0",
107104
"@types/node": "24.10.9",
108105
"@types/react": "19.2.10",
109106
"@types/react-dom": "19.2.3",
110107
"@types/react-router-dom": "5.3.3",
108+
"@vitejs/plugin-react": "^5.1.3",
109+
"@vitest/coverage-v8": "4.0.18",
110+
"@vitest/ui": "4.0.18",
111111
"axios": "1.13.4",
112112
"clsx": "2.1.1",
113113
"concurrently": "9.2.1",
@@ -119,11 +119,10 @@
119119
"electron": "40.1.0",
120120
"electron-builder": "26.6.0",
121121
"graphql": "16.12.0",
122+
"happy-dom": "^20.4.0",
122123
"html-webpack-plugin": "5.6.6",
123124
"husky": "9.1.7",
124-
"identity-obj-proxy": "3.0.0",
125-
"jest": "30.2.0",
126-
"jest-environment-jsdom": "30.2.0",
125+
"jsdom": "27.4.0",
127126
"mini-css-extract-plugin": "2.10.0",
128127
"nock": "13.5.6",
129128
"postcss": "8.5.6",
@@ -132,10 +131,10 @@
132131
"tailwind-merge": "3.4.0",
133132
"tailwindcss": "4.1.18",
134133
"terser-webpack-plugin": "5.3.16",
135-
"ts-jest": "29.4.6",
136134
"ts-loader": "9.5.4",
137135
"ts-node": "10.9.2",
138136
"typescript": "5.9.3",
137+
"vitest": "4.0.18",
139138
"webpack": "5.104.1",
140139
"webpack-cli": "6.0.1",
141140
"webpack-merge": "6.0.1"
@@ -153,6 +152,6 @@
153152
},
154153
"lint-staged": {
155154
"*": "biome check --fix --no-errors-on-unmatched",
156-
"*.{js,ts,tsx}": "pnpm test:changed --passWithNoTests --updateSnapshot"
155+
"*.{js,ts,tsx}": "pnpm test --changed --passWithNoTests --update --run"
157156
}
158157
}

0 commit comments

Comments
 (0)