Using encore test is recommended because it:
Encore provides isolated test databases:
Mock getAuthData to call auth: true endpoints directly as a given user:
The mock only affects code in the test process that reads getAuthData() directly. Calls made through ~encore/clients go through the Encore runtime, which does not see the mock, so an auth: true endpoint called that way fails with "endpoint requires auth but none provided". Pass the auth data explicitly instead:
Test the underlying function, not the cron schedule:
Create vite.config.ts (required for ~encore imports):
Install the Vitest extension and add to .vscode/settings.json:
Note: For VS Code test explorer, disable file-level parallelism to avoid port conflicts:
Re-enable for CI: encore test --fileParallelism=true