make appConfig not global and migrate to bun tests#278
make appConfig not global and migrate to bun tests#278
Conversation
|
README check ran. 4 issue(s) found and applied: added missing |
2b91601 to
5aaca3d
Compare
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/cli@0.0.33-pr.278.bb8cb20Prefer not to change any import paths? Install using npm alias so your code still imports npm i "base44@npm:@base44-preview/cli@0.0.33-pr.278.bb8cb20"Or add it to your {
"dependencies": {
"base44": "npm:@base44-preview/cli@0.0.33-pr.278.bb8cb20"
}
}
Preview published to npm registry — try new features instantly! |
|
README check ran. 3 issue(s) found and applied: added missing |
|
README check ran. No issues found — all commands, descriptions, installation info, and quick start examples are accurate. |
Note
Description
Migrates the test runner from Vitest to Bun's native
bun:test, removing the Vitest dependency entirely. Also refactors the globalappConfigcache pattern into a scopedwithAppConfig()helper, eliminating mutable module-level state and making app config accessible viacontext.appConfiginCLIContext.Related Issue
None
Type of Change
Changes Made
bun:testacross all test files; removedvitestdevDependency andvitest.config.ts; addedbunfig.tomlfor test timeout config; updatedpackage.jsonscripts (bun run test→bun test)setAppConfig()/initAppConfig()cache with a scopedwithAppConfig(config, fn)helper that restores previous state after execution; renamedinitAppConfig()toresolveAppConfig()(pure, no caching); addedappConfig?: AppConfigtoCLIContextso commands access it via context rather than a globalAppConfigSchema/AppConfig(file schema) renamed toAppConfigFileSchema/AppConfigFileto avoid collision with the new exportedAppConfigtype ({ id, projectRoot })getDashboardUrlsignature change: Now requires an explicitprojectIdargument instead of optionally falling back to the global app config cachedownloadProjectnow usesarrayBuffer()+Readable.from(buffer)instead ofReadable.fromWeb(), fixing tar extraction failures under Bunhomedir()fix:getBase44GlobalDirnow readsprocess.env.HOMEdirectly before falling back toos.homedir(), working around Bun's cachedhomedir()valuevi.resetModules()per test; CLI module is now loaded once and cached (loadProgram()); updatedvi.mock()calls to use factory functions compatible withbun:testconnectors pull/push,eject, andtypes generateto the command table; updated testing docs to referencebun testTesting
npm test)Checklist
docs/(AGENTS.md) if I made architectural changesAdditional Notes
The
withAppConfig()scoped pattern is safer than the previous global cache because it automatically restores the previous config when the callback completes or throws, preventing state leakage between tests. TheCLITestkitno longer callsvi.resetModules()on each test run, instead reusing a single cached module import — this is both faster and required sincebun:testdoes not supportvi.resetModules()the same way Vitest did.🤖 Generated by Claude | 2026-02-19 14:48 UTC