From c663ca52ca55b2c24ee901e4da2489f0606d8f29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=CC=88mer=20Duran?= Date: Sun, 7 Sep 2025 16:12:21 +0300 Subject: [PATCH] Tests: Refactor Makefile and package.json for test commands --- Makefile | 14 ++++---------- frontend/package.json | 9 ++++----- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 8a18b854a..d86488077 100644 --- a/Makefile +++ b/Makefile @@ -334,7 +334,7 @@ watch-js: (cd frontend && env BUILD_ENV=development NODE_ENV=production npm run watch) test-js: $(info Running JS unit tests...) - (cd frontend && env TZ=UTC BUILD_ENV=development NODE_ENV=development BABEL_ENV=test npm run test) + (cd frontend && npm run test) acceptance: $(info Running public-mode tests in Chrome...) (cd frontend && npm run testcafe -- "chrome --headless=new" --test-grep "^(Multi-Window)\:*" --test-meta mode=public --config-file ./testcaferc.json --experimental-multiple-windows "tests/acceptance" && npm run testcafe -- "chrome --headless=new" --test-grep "^(Common|Core)\:*" --test-meta mode=public --config-file ./testcaferc.json "tests/acceptance") @@ -353,21 +353,15 @@ acceptance-auth-short: acceptance-auth-firefox: $(info Running JS acceptance-auth tests in Firefox...) (cd frontend && npm run testcafe -- firefox:headless --test-grep "^(Common|Core)\:*" --test-meta mode=auth --config-file ./testcaferc.json --disable-native-automation "tests/acceptance") -vitest: - $(info Running Vitest unit tests...) - (cd frontend && npm run vitest) vitest-watch: $(info Running Vitest unit tests in watch mode...) - (cd frontend && npm run vitest-watch) + (cd frontend && npm run test-watch) vitest-coverage: $(info Running Vitest unit tests with coverage...) - (cd frontend && npm run vitest-coverage) + (cd frontend && npm run test-coverage) vitest-component: $(info Running Vitest component tests...) - (cd frontend && npm run vitest-component) -vitest-ui: - $(info Opening Vitest UI...) - (cd frontend && npm run vitest-ui) + (cd frontend && npm run test-component) reset-mariadb: $(info Resetting photoprism database...) mysql < scripts/sql/reset-photoprism.sql diff --git a/frontend/package.json b/frontend/package.json index c867be42b..92706b689 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -17,11 +17,10 @@ "gettext-compile": "vue-gettext-compile", "gettext-extract": "gettext-extract --output src/locales/translations.pot $(find ${SRC:-src} -type f \\( -iname \\*.vue -o -iname \\*.js \\) -not -path src/common/gettext.js)", "lint": "eslint --cache src/ *.js", - "test": "env TZ=UTC vitest run", - "test-watch": "env TZ=UTC vitest --watch", - "test-coverage": "env TZ=UTC vitest run --coverage", - "test-component": "env TZ=UTC vitest run tests/vitest/component", - "test-ui": "env TZ=UTC vitest --ui --watch", + "test": "cross-env TZ=UTC BUILD_ENV=development NODE_ENV=development BABEL_ENV=test vitest run", + "test-watch": "cross-env TZ=UTC BUILD_ENV=development NODE_ENV=development BABEL_ENV=test vitest --watch", + "test-coverage": "cross-env TZ=UTC BUILD_ENV=development NODE_ENV=development BABEL_ENV=test vitest run --coverage", + "test-component": "cross-env TZ=UTC BUILD_ENV=development NODE_ENV=development BABEL_ENV=test vitest run tests/vitest/component", "testcafe": "testcafe", "trace": "webpack --stats-children", "update": "npm update --save --package-lock && npm install --no-update-notifier --no-audit",