title: How can I mock serial port during development?
body: <p>I am developing a node.js application for my Raspberry Pi which receives data from its serial port, but I don't directly develop the application on it, I use my main computer instead. So I have this code in my <code>app.js</code> :</p>
  
  <pre><code>var serialport = require("serialport");
  var SerialPort = serialport.SerialPort;
  var sp = new SerialPort("/dev/ttyACM0", {
      parser: serialport.parsers.readline("\n")
  });
  
  sp.on("data", function (rawData) {
  ...
  </code></pre>
  
  <p>This works well on the Rasperry Pi but I want to be able to run the application on my development computer first without having to comment every block of code about the serial port. </p>
  
  <p>What is the best way to achieve this ? Is there a way to mock the serial port ?</p>