Skip to content

Commit dc33f3c

Browse files
authored
Added implementation of V1 async_work runtime functions (#183)
* Added RuntimeNodeApiAsync class * Refactor + fixed externel buffer * Passing callInvoker down * Added async addon test * Added assertions to buffer tests * New line added after file generation * Added changeset * Added Android OnLoad * Cleanup * Removed duplicated line * Applied formatting * Moved setting CallInvoker to turbo module constructor * Added assert dependency * Stored call invokers by napi_env * Updated package-lock * refactor: Move 'bindings' require statement inside module exports for better scoping * fix: Removed the async from tests * chore: revert to previous version to test pipeline stability * fix: restore assert statements in tests + pulling device logs
1 parent 8557768 commit dc33f3c

23 files changed

+1076
-130
lines changed

.changeset/rich-donuts-mix.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"react-native-node-api-test-app": patch
3+
"react-native-node-api": patch
4+
---
5+
6+
Added implementation of async work runtime functions

.github/workflows/check.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,18 @@ jobs:
152152
adb reverse tcp:8090 tcp:8090
153153
# Uninstall the app if already in the snapshot (unlikely but could result in a signature mismatch failure)
154154
adb uninstall com.microsoft.reacttestapp || true
155+
# Start logcat in background and save logs
156+
adb logcat > emulator-logcat.txt 2>&1 &
157+
LOGCAT_PID=$!
155158
# Build, install and run the app
156159
npm run test:android -- --mode Release
157160
# Wait a bit for the sub-process to terminate, before terminating the emulator
158161
sleep 5
162+
# Stop logcat
163+
kill $LOGCAT_PID || true
164+
- name: Upload device logs
165+
if: always()
166+
uses: actions/upload-artifact@v4
167+
with:
168+
name: emulator-logcat
169+
path: apps/test-app/emulator-logcat.txt

apps/test-app/App.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ function loadTests() {
1414
for (const [suiteName, examples] of Object.entries(nodeAddonExamples)) {
1515
describe(suiteName, () => {
1616
for (const [exampleName, requireExample] of Object.entries(examples)) {
17-
it(exampleName, () => {
18-
requireExample();
17+
it(exampleName, async () => {
18+
const test = requireExample();
19+
if (test instanceof Function) {
20+
await test();
21+
}
1922
});
2023
}
2124
});

0 commit comments

Comments
 (0)