Passing a JS ArrayBuffer to a Java ByteBuffer parameter leaks it in @nativescript/android 9.0.4 through 9.1.1: JsArgConverter wraps the backing store with NewDirectByteBuffer and takes a JNI global ref that it never deletes. The ref keeps the ByteBuffer reachable, so makeInstanceWeakAndCheckIfAlive always answers "alive", the JS finalizer re-arms, and V8 never frees the ArrayBuffer. submitSurfaceFrame passed a fresh copy of each frame this way, so every frame leaked a full surface (576x260, 640x452 or 640x480 bytes) plus one global ref, including frames that Java then discards as unchanged. The draw-list buffer and buzzer payloads leaked the same way. Each payload now goes through a reused Java direct ByteBuffer (app/native/java-direct-buffer.ts): JS writes into it through an ArrayBuffer.from view, and the Java object itself is passed, which takes NativeScript's ordinary object path. Every consumer (SurfaceCompositor applyAndComposite, playBuzzerSequence) copies before returning, so one buffer per JS context is safe. Covered: the communicator bridge (frames, draw lists, buzzer, which also carries EvenHub tones), the preview-only display, and all eight worker apps. Workers submit through the Android getActiveDisplay() (frames) and worker-buzzer (tones), so the reused buffers live there rather than in each worker; the worker sources are shared with iOS, whose active display takes the ArrayBuffer itself. The smaller one-off crossings (glyph and image atlas registration, the gray preview helper, firmware and file writes) are left as they are. tests/java-direct-buffer.test.cjs covers the helper against a fake ByteBuffer, and the Android worker-buzzer test stubs it. (Rebased onto main by James Babcock: worker changes moved into active-display.ts and worker-buzzer.ts.) Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Tests
Faceclaw's pairing logic (app/g2/glasses-hardware-identity.ts,
ble-proximity.ts, even-advertisement.ts, pairing-candidates.ts,
glasses-artwork.ts) is written without NativeScript imports so it can run
under plain node. The tests here cover hardware-identity decoding, proximity
estimation, the advertisement parsers, and left↔right pair grouping.
Run with:
npm test
That compiles the pure modules with the project's TypeScript into
.test-build/ (git-ignored) and runs node --test tests/. No extra
dependencies are needed — the tests are plain .test.cjs files that use
node:test and node:assert.
The shared Kotlin suite runs separately from the Node tests:
npm run test:kotlin
npm run test:kotlin:ios
It includes the migrated compass, R1 battery, gesture and texture Java fixtures, which now call the Kotlin implementation from Android host tests. Common tests also run as native iOS simulator binaries. See the Kotlin README for SDK requirements, source layout and coverage. The compass and battery fixtures retain the golden packets shared with firmware tests.
The native iOS EvenHub probe runs separately on a booted simulator:
node tests/ios-evenhub-native.cjs <simulator-UUID>
It compiles the production WKWebView host into an isolated app and checks local and remote loading, document-start injection, assets, storage and navigation. It then opens Safari to background the probe and verifies that injected timeouts, intervals and animation callbacks still fire, and cancelled timers stay cancelled. A short UIKit background task keeps the test process running without glasses. This covers the ticker's background behavior; sustained execution with BLE and a locked physical phone still requires device testing.