UNPKG

node-mac-recorder

Version:

Native macOS screen recording package for Node.js applications

52 lines (42 loc) • 1.94 kB
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);