mock-serialport

0.0.1 • Public • Published

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();
}

Readme

Keywords

none

Package Sidebar

Install

npm i mock-serialport

Weekly Downloads

2

Version

0.0.1

License

MIT

Last publish

Collaborators

  • prestonresearch