node-mac-recorder
Version:
Native macOS screen recording package for Node.js applications
52 lines (42 loc) ⢠1.94 kB
JavaScript
const MacRecorder = require('./index');
console.log('š Testing ScreenCaptureKit Synchronous Operations...\n');
try {
const recorder = new MacRecorder();
console.log('ā
Recorder created successfully');
// Test if we can access the native module methods directly
console.log('š Available methods:');
const methods = Object.getOwnPropertyNames(recorder.__proto__);
methods.forEach(method => {
if (typeof recorder[method] === 'function') {
console.log(` ⢠${method}()`);
}
});
console.log('\nšÆ Testing basic functionality:');
// Test recording status (should be sync and work)
try {
const status = recorder.getStatus();
console.log(`ā
getStatus(): ${JSON.stringify(status)}`);
} catch (err) {
console.log(`ā getStatus() failed: ${err.message}`);
}
// Test cursor position (should be sync and work)
try {
const cursor = recorder.getCurrentCursorPosition();
console.log(`ā
getCurrentCursorPosition(): x=${cursor.x}, y=${cursor.y}, type=${cursor.cursorType}`);
} catch (err) {
console.log(`ā getCurrentCursorPosition() failed: ${err.message}`);
}
// Test cursor capture status (should be sync)
try {
const cursorStatus = recorder.getCursorCaptureStatus();
console.log(`ā
getCursorCaptureStatus(): tracking=${cursorStatus.isTracking}`);
} catch (err) {
console.log(`ā getCursorCaptureStatus() failed: ${err.message}`);
}
console.log('\nš ScreenCaptureKit sync tests completed');
console.log('ā ļø Async functions (getDisplays, getWindows, getAudioDevices) may hang due to permission dialogs');
console.log('š” To fix: Grant screen recording permissions in System Preferences > Privacy & Security');
} catch (error) {
console.error('ā Critical error:', error);
}
process.exit(0);