Files
Neil 531658f1d1 Plugin test kit: orca/testing, orca plugin test and orca plugin check (#36969)
* feat(plugins): orca/testing kit, `orca plugin test` and `orca plugin check`

- `orca/testing` mounts a components panel in plain Node (node:test, vitest, bun) with the real
  runtime and Orca's own tree validator: find by text/role/label/testId, press/type/submit/toggle/
  select that resolve once the panel settles, tree() snapshots, errors (with stacks) and warnings,
  persisted state (with stored() for migrations), emit/setVisible/rerender, and unmount running
  setup cleanup. It re-exports node:test and strict assert so tests type-check without @types/node.
- mockHost refuses what Orca refuses with the same codes (surface, capability from the manifest,
  params, a gesture method without a press), checks configured results against the host API, and
  records calls.
- `orca plugin test [dir]` discovers *.test.ts(x) and runs them with node:test through Node module
  hooks that resolve `orca` like the guest's import map and transpile/resolve sources exactly as
  Orca's build-less loader, or with the plugin's own vitest via a generated config.
- `orca plugin check [dir]` validates, then renders each components panel once and reports what it
  threw (file:line), layouts Orca would refuse, and props it would drop.
- The kit, hooks and register entry ship minified beside orca-runtime.mjs and are unpacked from asar;
  typings land in .orca/types/orca-testing. The components template and hello-tsx get sample tests.
- ui.error carries an optional stack; a new runtime starts every atom from its initial value; the
  hydration fallback timer is cleared once hydrated.

* plugins: run plugin test/check on a system Node or Orca's own, and warn they are unsandboxed

* test(plugins): run the shipped example plugin tests from the unit suite
2026-11-01 02:42:12 -08:00

884 B

Hello TSX

A components panel written in TSX with no build step and no dist/ folder. Orca transpiles src/*.tsx and src/*.ts when the panel loads (types stripped, JSX compiled for orca, relative imports such as ./todos resolved to their files).

orca plugin dev load .   # also writes .orca/types, the typings tsconfig.json extends
npx tsc -p .             # optional type check
orca plugin test .       # runs src/panel.test.tsx in Node with orca/testing
orca plugin check .      # renders the panel once and reports errors with file:line

Import only orca and relative files: there is no bundler, so import 'react' fails with an error naming the file and the import.

It shows the components API: keyed atoms persisted per plugin (src/todos.ts), derived values, setup(ctx) subscribing to the typed on('theme') event, and ui.has feature detection.