Skip to content

Feat/vitest #681

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

Open
wants to merge 16 commits into
base: develop
Choose a base branch
from
Open

Feat/vitest #681

wants to merge 16 commits into from

Conversation

LoTerence
Copy link
Member

@LoTerence LoTerence commented Apr 21, 2025

Fixes #670

Changes

  • install vitest and required dependencies
  • configured vitest
  • migrate old jest tests to vitest
  • reinstalled package-lock.json and node_modules
  • uninstalled jest and its dependencies

Minor changes:

  • added named volume for node_modules to docker compose. The vite container wasn't working on windows before, and naming the volume helped to debug it.
  • installed package eslint-config-prettier to fix a linter issue, since eslint got updated to version 9.25.1 in the new package-lock.json
  • linted frontend files - mostly effected changes to tailwind classnames order in some components

How it works

In the /frontend folder, run the command:

npm run test

It should say all tests pass, although there are some warnings:
image

How to test this PR

  • make sure npm run test works.
  • please make sure the new npm packages and docker compose works on your machine
  • You might have to reinstall node_modules to get it to work: rm -rf node_modules && npm i

@LoTerence LoTerence requested a review from bennyv8 April 22, 2025 01:02
@LoTerence
Copy link
Member Author

This is the error I got when I originally tried to npm install vitest, then run docker:

Error: Cannot find module @rollup/rollup-linux-x64-musl. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.

I only got this when I tried to run docker compose up. Not when I was running the vite server on my local machine.

During dev meeting on 04/28, Benny said he tried testing this PR's docker compose up and it didnt work on his machine. He mentioned docker on windows and mac uses different linux binaries under the hood.

Reference links:

@LoTerence
Copy link
Member Author

04/30/25 update:

I made a new commit. This time instead of removing node_modules and package-lock.json and reinstalling, I took the package.json and package-lock.json from the develop branch, and used the npm cli to install packages one at a time, testing docker with each new install to make sure the @rollup/rollup-linux-x64-musl missing module error didn't occur again.

For some reason no issues came up this time 🤔

@bennyv8 Could you try testing and reviewing again?

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.

Migrate frontend unit tests to Vitest
1 participant