Tests: Refactor Makefile and package.json for test commands

This commit is contained in:
Ömer Duran
2025-09-07 16:12:21 +03:00
parent 7131b327f9
commit c663ca52ca
2 changed files with 8 additions and 15 deletions

View File

@@ -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

View File

@@ -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",