test: update tests, migrate backend to vitest

Backend had tests written in mocha as well as a test written for jest
(created by an AI utility, wasn't compatible with mocha tests). The AI
generated test had merit so it was migrated to vitest along with all the
mocha tests, which supports conventions from both frameworks.

Vitest also has an excellent watcher cli.

The root repo package.json now runs unit tests in backend. Before it was
only running tests defined in the _test method of backend services.
This commit is contained in:
KernelDeimos
2025-07-04 18:19:14 -04:00
parent 87e15cac2d
commit 502204a7b7
14 changed files with 1778 additions and 403 deletions

View File

@@ -28,7 +28,7 @@
"webpack-cli": "^5.1.1"
},
"scripts": {
"test": "npx mocha src/phoenix/test && node src/backend/tools/test",
"test": "npx mocha src/phoenix/test && npx vitest run src/backend && node src/backend/tools/test",
"start=gui": "nodemon --exec \"node dev-server.js\" ",
"start": "node ./tools/run-selfhosted.js",
"build": "cd src/gui; node ./build.js",