Skip to content

enhance(backend/test): Migrate tests to vitest#16935

Merged
syuilo merged 57 commits intomisskey-dev:developfrom
kakkokari-gtyih:enh-be-test-vitest
Apr 20, 2026
Merged

enhance(backend/test): Migrate tests to vitest#16935
syuilo merged 57 commits intomisskey-dev:developfrom
kakkokari-gtyih:enh-be-test-vitest

Conversation

@kakkokari-gtyih
Copy link
Copy Markdown
Contributor

@kakkokari-gtyih kakkokari-gtyih commented Dec 4, 2025

What

  • バックエンドのテストをVitestに置き換え
  • oxcがdecoratorのパースも可能なため、swcを完全に排除することが可能

Why

Additional info (optional)

Checklist

  • Read the contribution guide
  • Test working in a local environment
  • (If needed) Add story of storybook
  • (If needed) Update CHANGELOG.md
  • (If possible) Add tests

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 4, 2025

このPRによるapi.jsonの差分
差分はありません。
Get diff files from Workflow Page

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 4, 2025

Codecov Report

❌ Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 24.86%. Comparing base (1391269) to head (27a34b1).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
...kages/backend/src/server/api/endpoints/endpoint.ts 0.00% 3 Missing ⚠️
...ages/backend/src/server/api/endpoints/endpoints.ts 0.00% 3 Missing ⚠️
...ages/backend/src/server/web/ClientServerService.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           develop   #16935       +/-   ##
============================================
- Coverage    62.42%   24.86%   -37.57%     
============================================
  Files         1162     1150       -12     
  Lines       116557    38825    -77732     
  Branches      9079    10770     +1691     
============================================
- Hits         72764     9654    -63110     
+ Misses       41601    23403    -18198     
- Partials      2192     5768     +3576     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kakkokari-gtyih
Copy link
Copy Markdown
Contributor Author

もにょもにょしてたらunit testのほうは動き始めた

@kakkokari-gtyih
Copy link
Copy Markdown
Contributor Author

力尽きた

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 16, 2025

Backend memory usage comparison

Before GC

Metric base (MB) head (MB) Diff (MB) Diff (%)
VmRSS 303.53 MB 297.07 MB -6.45 MB -2.12%
VmHWM 303.53 MB 297.07 MB -6.45 MB -2.12%
VmSize 23101.97 MB 23095.12 MB -6.84 MB -0.02%
VmData 1365.73 MB 1359.11 MB -6.62 MB -0.48%

After GC

Metric base (MB) head (MB) Diff (MB) Diff (%)
VmRSS 303.54 MB 297.08 MB -6.45 MB -2.12%
VmHWM 303.54 MB 297.08 MB -6.45 MB -2.12%
VmSize 23101.97 MB 23095.37 MB -6.59 MB -0.02%
VmData 1365.73 MB 1359.36 MB -6.37 MB -0.46%

After Request

Metric base (MB) head (MB) Diff (MB) Diff (%)
VmRSS 303.96 MB 297.35 MB -6.61 MB -2.17%
VmHWM 303.96 MB 297.35 MB -6.61 MB -2.17%
VmSize 23102.05 MB 23095.54 MB -6.51 MB -0.02%
VmData 1365.82 MB 1359.45 MB -6.36 MB -0.46%

See workflow logs for details

@kakkokari-gtyih
Copy link
Copy Markdown
Contributor Author

なんか何やってもe2eだけ起動してくれない

@anatawa12
Copy link
Copy Markdown
Member

anatawa12 commented Apr 19, 2026

endpoints/endpoints.tsと``endpoints/endpoint.ts`が循環 import になってるのでそれがなんかvitestのtransform時にいい感じに解決できていない可能性がありそうなので、それらでの直接のimportをやめてエンドポイントの実装内でのdynamic importにすると良いかもしれない


自分がendpointsのリファクタしたときに気になったけど一応動いてたので直さなかったって範囲なので、解消したほうが安定しそうだなとは思っていた

@kakkokari-gtyih
Copy link
Copy Markdown
Contributor Author

いけたっぽい

@kakkokari-gtyih kakkokari-gtyih changed the title enhance(backend/test): Migrate tests to vitest 【実験中】 enhance(backend/test): Migrate tests to vitest Apr 20, 2026
Comment thread packages/backend/test/unit/server/api/drive/files/create.ts Outdated
@syuilo
Copy link
Copy Markdown
Member

syuilo commented Apr 20, 2026

残り作業なんかあるかしら

@kakkokari-gtyih kakkokari-gtyih marked this pull request as ready for review April 20, 2026 05:56
@kakkokari-gtyih
Copy link
Copy Markdown
Contributor Author

たぶんない

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Apr 20, 2026
@syuilo syuilo merged commit 6d15fe3 into misskey-dev:develop Apr 20, 2026
40 checks passed
@syuilo
Copy link
Copy Markdown
Member

syuilo commented Apr 20, 2026

👍👍

@github-project-automation github-project-automation Bot moved this from Todo to Done in [実験中] 管理用 Apr 20, 2026
@kakkokari-gtyih kakkokari-gtyih deleted the enh-be-test-vitest branch April 20, 2026 05:57
m10i-0nyx pushed a commit to foundation0-link/misskey that referenced this pull request Apr 28, 2026
* wip

* update fake-timers and migrate

* fix

* remove jest-mock

* fix

* fix

* fix

* fix

* attempt to fix unit tests

* attempt to fix e2e tests

* fix federation test [ci skip]

* attempt to fix e2e tests

* fix typecheck

* fix unit tests

* fix

* attempt to fix e2e

* fix

* Revert "attempt to fix e2e"

This reverts commit b7b7b05.

* attempt to fix e2e

* revert attempt to fix e2e

* update deps

* update vitest

* migrate

* attempt to fix e2e

* update

* fix

* remove vite swc plugin as oxc parser can handle decorators

* attempt to fix drive/files/create test

* Revert "attempt to fix drive/files/create test"

This reverts commit 4715153.

* fix: エンドポイントにまつわるテストをunitからe2eに移動

* attempt to fix e2e

* remove swc

* attempt to fix e2e

* Revert "attempt to fix e2e"

This reverts commit 9fb86a4.

* add logs for debug

* attempt to fix e2e

* Partially revert "attempt to fix e2e"

This reverts commit fb0008c.

* attempt to fix test

* fix: attempt to fix test

* Revert "fix: attempt to fix test"

This reverts commit ed2f5c4.

* Revert "attempt to fix test"

This reverts commit d7329c4.

* attempt to fix e2e

* fix: surpass eventemitter warning by increasing defaultMaxListeners

* attempt to fix e2e

* fix

* fix e2e not ending properly

* exp: add hanging-process reporter for investigation

* Revert "exp: add hanging-process reporter for investigation"

This reverts commit 26851f8.

* update changelog
m10i-0nyx pushed a commit to foundation0-link/misskey that referenced this pull request Apr 28, 2026
* wip

* update fake-timers and migrate

* fix

* remove jest-mock

* fix

* fix

* fix

* fix

* attempt to fix unit tests

* attempt to fix e2e tests

* fix federation test [ci skip]

* attempt to fix e2e tests

* fix typecheck

* fix unit tests

* fix

* attempt to fix e2e

* fix

* Revert "attempt to fix e2e"

This reverts commit b7b7b05.

* attempt to fix e2e

* revert attempt to fix e2e

* update deps

* update vitest

* migrate

* attempt to fix e2e

* update

* fix

* remove vite swc plugin as oxc parser can handle decorators

* attempt to fix drive/files/create test

* Revert "attempt to fix drive/files/create test"

This reverts commit 4715153.

* fix: エンドポイントにまつわるテストをunitからe2eに移動

* attempt to fix e2e

* remove swc

* attempt to fix e2e

* Revert "attempt to fix e2e"

This reverts commit 9fb86a4.

* add logs for debug

* attempt to fix e2e

* Partially revert "attempt to fix e2e"

This reverts commit fb0008c.

* attempt to fix test

* fix: attempt to fix test

* Revert "fix: attempt to fix test"

This reverts commit ed2f5c4.

* Revert "attempt to fix test"

This reverts commit d7329c4.

* attempt to fix e2e

* fix: surpass eventemitter warning by increasing defaultMaxListeners

* attempt to fix e2e

* fix

* fix e2e not ending properly

* exp: add hanging-process reporter for investigation

* Revert "exp: add hanging-process reporter for investigation"

This reverts commit 26851f8.

* update changelog
m10i-0nyx pushed a commit to foundation0-link/misskey that referenced this pull request Apr 28, 2026
* wip

* update fake-timers and migrate

* fix

* remove jest-mock

* fix

* fix

* fix

* fix

* attempt to fix unit tests

* attempt to fix e2e tests

* fix federation test [ci skip]

* attempt to fix e2e tests

* fix typecheck

* fix unit tests

* fix

* attempt to fix e2e

* fix

* Revert "attempt to fix e2e"

This reverts commit b7b7b05.

* attempt to fix e2e

* revert attempt to fix e2e

* update deps

* update vitest

* migrate

* attempt to fix e2e

* update

* fix

* remove vite swc plugin as oxc parser can handle decorators

* attempt to fix drive/files/create test

* Revert "attempt to fix drive/files/create test"

This reverts commit 4715153.

* fix: エンドポイントにまつわるテストをunitからe2eに移動

* attempt to fix e2e

* remove swc

* attempt to fix e2e

* Revert "attempt to fix e2e"

This reverts commit 9fb86a4.

* add logs for debug

* attempt to fix e2e

* Partially revert "attempt to fix e2e"

This reverts commit fb0008c.

* attempt to fix test

* fix: attempt to fix test

* Revert "fix: attempt to fix test"

This reverts commit ed2f5c4.

* Revert "attempt to fix test"

This reverts commit d7329c4.

* attempt to fix e2e

* fix: surpass eventemitter warning by increasing defaultMaxListeners

* attempt to fix e2e

* fix

* fix e2e not ending properly

* exp: add hanging-process reporter for investigation

* Revert "exp: add hanging-process reporter for investigation"

This reverts commit 26851f8.

* update changelog
m10i-0nyx pushed a commit to foundation0-link/misskey that referenced this pull request Apr 28, 2026
* wip

* update fake-timers and migrate

* fix

* remove jest-mock

* fix

* fix

* fix

* fix

* attempt to fix unit tests

* attempt to fix e2e tests

* fix federation test [ci skip]

* attempt to fix e2e tests

* fix typecheck

* fix unit tests

* fix

* attempt to fix e2e

* fix

* Revert "attempt to fix e2e"

This reverts commit b7b7b05.

* attempt to fix e2e

* revert attempt to fix e2e

* update deps

* update vitest

* migrate

* attempt to fix e2e

* update

* fix

* remove vite swc plugin as oxc parser can handle decorators

* attempt to fix drive/files/create test

* Revert "attempt to fix drive/files/create test"

This reverts commit 4715153.

* fix: エンドポイントにまつわるテストをunitからe2eに移動

* attempt to fix e2e

* remove swc

* attempt to fix e2e

* Revert "attempt to fix e2e"

This reverts commit 9fb86a4.

* add logs for debug

* attempt to fix e2e

* Partially revert "attempt to fix e2e"

This reverts commit fb0008c.

* attempt to fix test

* fix: attempt to fix test

* Revert "fix: attempt to fix test"

This reverts commit ed2f5c4.

* Revert "attempt to fix test"

This reverts commit d7329c4.

* attempt to fix e2e

* fix: surpass eventemitter warning by increasing defaultMaxListeners

* attempt to fix e2e

* fix

* fix e2e not ending properly

* exp: add hanging-process reporter for investigation

* Revert "exp: add hanging-process reporter for investigation"

This reverts commit 26851f8.

* update changelog
m10i-0nyx pushed a commit to foundation0-link/misskey that referenced this pull request Apr 30, 2026
* wip

* update fake-timers and migrate

* fix

* remove jest-mock

* fix

* fix

* fix

* fix

* attempt to fix unit tests

* attempt to fix e2e tests

* fix federation test [ci skip]

* attempt to fix e2e tests

* fix typecheck

* fix unit tests

* fix

* attempt to fix e2e

* fix

* Revert "attempt to fix e2e"

This reverts commit b7b7b05.

* attempt to fix e2e

* revert attempt to fix e2e

* update deps

* update vitest

* migrate

* attempt to fix e2e

* update

* fix

* remove vite swc plugin as oxc parser can handle decorators

* attempt to fix drive/files/create test

* Revert "attempt to fix drive/files/create test"

This reverts commit 4715153.

* fix: エンドポイントにまつわるテストをunitからe2eに移動

* attempt to fix e2e

* remove swc

* attempt to fix e2e

* Revert "attempt to fix e2e"

This reverts commit 9fb86a4.

* add logs for debug

* attempt to fix e2e

* Partially revert "attempt to fix e2e"

This reverts commit fb0008c.

* attempt to fix test

* fix: attempt to fix test

* Revert "fix: attempt to fix test"

This reverts commit ed2f5c4.

* Revert "attempt to fix test"

This reverts commit d7329c4.

* attempt to fix e2e

* fix: surpass eventemitter warning by increasing defaultMaxListeners

* attempt to fix e2e

* fix

* fix e2e not ending properly

* exp: add hanging-process reporter for investigation

* Revert "exp: add hanging-process reporter for investigation"

This reverts commit 26851f8.

* update changelog
m10i-0nyx pushed a commit to foundation0-link/misskey that referenced this pull request Apr 30, 2026
* wip

* update fake-timers and migrate

* fix

* remove jest-mock

* fix

* fix

* fix

* fix

* attempt to fix unit tests

* attempt to fix e2e tests

* fix federation test [ci skip]

* attempt to fix e2e tests

* fix typecheck

* fix unit tests

* fix

* attempt to fix e2e

* fix

* Revert "attempt to fix e2e"

This reverts commit b7b7b05.

* attempt to fix e2e

* revert attempt to fix e2e

* update deps

* update vitest

* migrate

* attempt to fix e2e

* update

* fix

* remove vite swc plugin as oxc parser can handle decorators

* attempt to fix drive/files/create test

* Revert "attempt to fix drive/files/create test"

This reverts commit 4715153.

* fix: エンドポイントにまつわるテストをunitからe2eに移動

* attempt to fix e2e

* remove swc

* attempt to fix e2e

* Revert "attempt to fix e2e"

This reverts commit 9fb86a4.

* add logs for debug

* attempt to fix e2e

* Partially revert "attempt to fix e2e"

This reverts commit fb0008c.

* attempt to fix test

* fix: attempt to fix test

* Revert "fix: attempt to fix test"

This reverts commit ed2f5c4.

* Revert "attempt to fix test"

This reverts commit d7329c4.

* attempt to fix e2e

* fix: surpass eventemitter warning by increasing defaultMaxListeners

* attempt to fix e2e

* fix

* fix e2e not ending properly

* exp: add hanging-process reporter for investigation

* Revert "exp: add hanging-process reporter for investigation"

This reverts commit 26851f8.

* update changelog
m10i-0nyx pushed a commit to foundation0-link/misskey that referenced this pull request Apr 30, 2026
* wip

* update fake-timers and migrate

* fix

* remove jest-mock

* fix

* fix

* fix

* fix

* attempt to fix unit tests

* attempt to fix e2e tests

* fix federation test [ci skip]

* attempt to fix e2e tests

* fix typecheck

* fix unit tests

* fix

* attempt to fix e2e

* fix

* Revert "attempt to fix e2e"

This reverts commit b7b7b05.

* attempt to fix e2e

* revert attempt to fix e2e

* update deps

* update vitest

* migrate

* attempt to fix e2e

* update

* fix

* remove vite swc plugin as oxc parser can handle decorators

* attempt to fix drive/files/create test

* Revert "attempt to fix drive/files/create test"

This reverts commit 4715153.

* fix: エンドポイントにまつわるテストをunitからe2eに移動

* attempt to fix e2e

* remove swc

* attempt to fix e2e

* Revert "attempt to fix e2e"

This reverts commit 9fb86a4.

* add logs for debug

* attempt to fix e2e

* Partially revert "attempt to fix e2e"

This reverts commit fb0008c.

* attempt to fix test

* fix: attempt to fix test

* Revert "fix: attempt to fix test"

This reverts commit ed2f5c4.

* Revert "attempt to fix test"

This reverts commit d7329c4.

* attempt to fix e2e

* fix: surpass eventemitter warning by increasing defaultMaxListeners

* attempt to fix e2e

* fix

* fix e2e not ending properly

* exp: add hanging-process reporter for investigation

* Revert "exp: add hanging-process reporter for investigation"

This reverts commit 26851f8.

* update changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wanted packages/backend:test packages/backend Server side specific issue/PR size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Development

Successfully merging this pull request may close these issues.

3 participants