Files
actual/packages/api
Matiss Janis Aboltins 50feba1afb [AI] Fix flaky API test timeouts and use sync file write in tests (#7806)
* [AI] Fix flaky upload-user-file test

The "uploads and updates an existing file successfully" test wrote the
old file content using the async callback form of fs.writeFile without
awaiting it. That write could land after the upload endpoint had already
written the new content, leaving the file with stale content and failing
the assertion. Use fs.writeFileSync so the setup completes before the
request is sent.

* [AI] Increase api test timeouts to fix flaky budget-load test

methods.test.ts loads a budget file and runs all DB migrations in each
test/hook. On busy CI runners this regularly approaches the default 5s
limit, and when it exceeds it the in-flight loadBudget keeps running after
teardown closes the database, producing a cascade of unhandled rejections
("database connection is not open", "no such table: v_schedules",
"Cannot read properties of undefined (reading 'timestamp')") that fail the
suite. Bump testTimeout/hookTimeout to 20s for the api package.

* [AI] Add release note for flaky test fixes

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-11 22:07:25 +00:00
..

npm install @actual-app/api

View docs here: https://actualbudget.org/docs/api/

TypeScript

@actual-app/api publishes TypeScript declarations. Consumers using TypeScript must set moduleResolution to "bundler", "nodenext", or "node16" in their tsconfig.json. Legacy "node" / "node10" / "classic" resolution is not supported in strict mode — the published declarations rely on package.json exports conditions that older resolvers don't honor.