Unit

Run the unit tests: pure functions, with no servers and no test context.

Syntax

$ npm run test:unit
$ npx vitest run --project unit
$ npx vitest --watch --project unit utils

There is no vela test:unit command; Vitest’s own commands do the job. The unit project in vitest.config.ts has no globalSetup and no setup file, so running it never starts PocketBase or the app, and a watch session on a pure function reruns in well under a second.

Which tests are unit tests

File names decide. A test named server.test.ts or <name>.server.test.ts belongs to the server project and runs against the app and its database. Every other src/**/*.test.ts belongs to unit. The generators follow the convention, so a project only has to name its own tests. A unit test that reaches for the test context fails at once, with no context to read, rather than silently running slower.

npm test runs both projects; see testing.