Skip to content

Commit a0917a3

Browse files
committed
fix: restore assert statements in tests + pulling device logs
1 parent 6230b02 commit a0917a3

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
@@ -146,7 +146,18 @@ jobs:
146146
adb reverse tcp:8090 tcp:8090
147147
# Uninstall the app if already in the snapshot (unlikely but could result in a signature mismatch failure)
148148
adb uninstall com.microsoft.reacttestapp || true
149+
# Start logcat in background and save logs
150+
adb logcat > emulator-logcat.txt 2>&1 &
151+
LOGCAT_PID=$!
149152
# Build, install and run the app
150153
npm run test:android -- --mode Release
151154
# Wait a bit for the sub-process to terminate, before terminating the emulator
152155
sleep 5
156+
# Stop logcat
157+
kill $LOGCAT_PID || true
158+
- name: Upload device logs
159+
if: always()
160+
uses: actions/upload-artifact@v4
161+
with:
162+
name: emulator-logcat
163+
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)