mirror of
https://github.com/stablyai/orca.git
synced 2026-11-14 18:07:45 +00:00
* perf(mobile): answer a page's ready that arrived before its bridge host A page's ready can reach the shell before the screen has built its bridge host (the host waits on the client and the host profile read). It used to be dropped, so init waited for the page's next retry, up to 2 s later. Keep the latest ready per session and answer it once the host exists. * perf(mobile): keep one prewarmed page document while Home is shown While native Home is on screen, boot one page document for the most recently connected host with a cached build, parked invisibly in the window. Opening a page from that build adopts it instead of building a WebView, which removes the WebView start and script parse from the tap. The spare is dropped when Home is left without a claim (2 s grace), on background, memory pressure, its own failure and before the cache deletes its files. It is never kept beside a shown page, and only phones with more than 3 GiB of RAM (4 GB phones) get one. A parked page is told to stop asking for init; the adopting view answers the ready it sent. Builds on Jinwoo's spare pool and replay work in #32203 and #32204. Co-authored-by: Jinwoo-H <73622457+Jinwoo-H@users.noreply.github.com> * fix(mobile): unregister the shell's memory callbacks from the context that registered them --------- Co-authored-by: Jinwoo-H <73622457+Jinwoo-H@users.noreply.github.com>
58 lines
2.1 KiB
TypeScript
58 lines
2.1 KiB
TypeScript
import { fileURLToPath } from 'node:url'
|
|
import { defineConfig } from 'vitest/config'
|
|
|
|
const vitestOxcConfig = { tsconfig: false } as never
|
|
|
|
export default defineConfig({
|
|
root: import.meta.dirname,
|
|
// Tests are excluded from the app tsconfig; disable that config for OXC so test modules still transform.
|
|
oxc: vitestOxcConfig,
|
|
resolve: {
|
|
// A faithful Node stand-in for the native module, rather than a mock in every test that reaches it.
|
|
alias: [
|
|
{
|
|
find: /^\.\/mobile-agent-icon-assets$/,
|
|
replacement: fileURLToPath(
|
|
new URL('./src/test-support/mobile-agent-icon-assets-node.ts', import.meta.url)
|
|
)
|
|
},
|
|
{
|
|
find: 'expo-crypto',
|
|
replacement: fileURLToPath(
|
|
new URL('./src/test-support/expo-crypto-node.ts', import.meta.url)
|
|
)
|
|
},
|
|
{
|
|
find: /^.*\/orca-mobile-web-shell\/src\/spare-document$/,
|
|
replacement: fileURLToPath(
|
|
new URL('./src/test-support/spare-document-node.ts', import.meta.url)
|
|
)
|
|
},
|
|
{
|
|
find: 'expo-haptics',
|
|
replacement: fileURLToPath(
|
|
new URL('./src/test-support/expo-haptics-node.ts', import.meta.url)
|
|
)
|
|
},
|
|
// Phone/host contract tests import original sources at runtime; only their Node type check reads declarations.
|
|
{ find: '@orca/test-mobile', replacement: fileURLToPath(new URL('./src', import.meta.url)) },
|
|
{ find: '@orca/test-host', replacement: fileURLToPath(new URL('../src', import.meta.url)) }
|
|
]
|
|
},
|
|
test: {
|
|
// Web renderer tests must resolve the SVG/icon libraries through the same host aliases.
|
|
server: {
|
|
deps: {
|
|
inline: ['lucide-react-native', 'react-native-svg'],
|
|
external: [/\/config\/scripts\/build-mobile-web-app-bundle\.mjs$/]
|
|
}
|
|
},
|
|
pool: 'threads',
|
|
environment: 'node',
|
|
setupFiles: ['./vitest.setup.ts'],
|
|
onConsoleLog: (log) => !log.includes('react-test-renderer is deprecated'),
|
|
// Collect component and script tests too so render regressions and CI tooling are covered.
|
|
include: ['src/**/*.test.ts', 'src/**/*.test.tsx', 'scripts/**/*.test.ts']
|
|
}
|
|
})
|