Skip to content
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

feat: replace jest with vitest #154

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

SRWieZ
Copy link
Member

@SRWieZ SRWieZ commented Jan 13, 2025

Replacing Jest with Vitest 🎉

Works out of the box with ESM and has fewer dependencies. And, error messages are much more clear.

  • Updated tests to use vitest instead of. jest
  • Added a new mock implementation for the electron module using vitest and a new test file to verify the mocking of the electron module using vitest. (resources/js/electron-plugin/tests/mocking.test.ts)
  • Removed a bunch of jest configuration files and dependencies since vitest supports ESM out of the box.
  • Bumped dependencies of vite, electron-vite and some eslint and stylelint plugins

But ⚠️ :

  • Removed old Jest mocks and tests for clipboard, dialog, and window endpoints (endpoints/clipboard.test.ts, endpoints/dialog.test.ts, endpoints/window.test.ts).
  • Mocking Electron is unreliable in both Jest and Vitest. I managed to get some tests working, but others broke. I believe we need to shift to end-to-end tests using Selenium/Playwright and the kitchen-sink app. The remaining tests still verify the boot process of the API server.

@SRWieZ
Copy link
Member Author

SRWieZ commented Mar 1, 2025

This is the best I can do right now 😅

If you have any suggestion, feel free to edit this PR.

Updated my first comment.

@gwleuverink @PeteBishwhip @simonhamp

@SRWieZ SRWieZ marked this pull request as ready for review March 1, 2025 13:33
@PeteBishwhip PeteBishwhip self-requested a review March 3, 2025 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant