0.0.1 • Published 8 years ago
mock-serialport v0.0.1
I created this to mock out my serial port so I could test code depending on it while on a machine without a 'serial port'.
Install
npm install mock-serialport
Usage
This is how I use this in some of my non-serial ported tests. Like serialservo.
var fileExists = require('file-exists');
var SerialPort = require('serialport');
var serialPort;
if (fileExists(portName)) {
serialPort = new SerialPort("/dev/ttyUSB0", {baudRate:9600});
} else {
serialPort = new MockSerialPort();
}
0.0.1
8 years ago