Add frontend tests to pre-commit and Makefile. (#1549)

Signed-off-by: ifuryst <ifuryst@gmail.com>
This commit is contained in:
Leo 2024-05-04 04:15:22 +08:00 committed by GitHub
parent bccb8297b8
commit 6013faeec5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 11 additions and 3 deletions

View File

@ -160,6 +160,13 @@ lint:
@$(MAKE) -s lint-frontend
@$(MAKE) -s lint-backend
test-frontend:
@echo "$(YELLOW)Running tests for frontend...$(RESET)"
@cd frontend && npm run test
test:
@$(MAKE) -s test-frontend
build-frontend:
@echo "$(YELLOW)Building frontend...$(RESET)"
@cd frontend && npm run build

View File

@ -1,3 +1,4 @@
#!/bin/sh
cd frontend
npx lint-staged
npm run test

View File

@ -39,7 +39,7 @@
"scripts": {
"start": "vite",
"build": "tsc && vite build",
"test": "vitest",
"test": "vitest run",
"preview": "vite preview",
"make-i18n": "node scripts/make-i18n-translations.cjs",
"prelint": "npm run make-i18n",
@ -48,7 +48,7 @@
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
"pre-commit": "npm run test && lint-staged"
}
},
"lint-staged": {

View File

@ -190,7 +190,7 @@ describe("SettingsModal", () => {
userEvent.click(saveButton);
});
expect(toastSpy).toHaveBeenCalledTimes(1);
expect(toastSpy).toHaveBeenCalledTimes(2);
});
it("should change the language", async () => {