Skip to content

Commit 5ce6a02

Browse files
committed
fix: restore assert statements in tests + pulling device logs
1 parent e1495a1 commit 5ce6a02

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

.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
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable @typescript-eslint/no-require-imports */
22
/* eslint-disable no-undef */
3+
const assert = require("assert");
34
const addon = require("bindings")("addon.node");
4-
// const assert = require("assert");
55

66
const toLocaleString = (text) => {
77
return text
@@ -11,16 +11,16 @@ const toLocaleString = (text) => {
1111
.join("");
1212
};
1313

14-
// module.exports = async () => {
15-
console.log(toLocaleString(addon.newBuffer()), addon.theText);
16-
console.log(toLocaleString(addon.newExternalBuffer()), addon.theText);
17-
console.log(toLocaleString(addon.copyBuffer()), addon.theText);
18-
let buffer = addon.staticBuffer();
19-
console.log(addon.bufferHasInstance(buffer), true);
20-
console.log(addon.bufferInfo(buffer), true);
21-
addon.invalidObjectAsBuffer({});
14+
module.exports = () => {
15+
assert.strictEqual(toLocaleString(addon.newBuffer()), addon.theText);
16+
assert.strictEqual(toLocaleString(addon.newExternalBuffer()), addon.theText);
17+
assert.strictEqual(toLocaleString(addon.copyBuffer()), addon.theText);
18+
let buffer = addon.staticBuffer();
19+
assert.strictEqual(addon.bufferHasInstance(buffer), true);
20+
assert.strictEqual(addon.bufferInfo(buffer), true);
21+
addon.invalidObjectAsBuffer({});
2222

23-
// TODO: Add gc tests
24-
// @see
25-
// https://github.com/callstackincubator/react-native-node-api/issues/182
26-
// };
23+
// TODO: Add gc tests
24+
// @see
25+
// https://github.com/callstackincubator/react-native-node-api/issues/182
26+
};

0 commit comments

Comments
 (0)