Commit graph

63 commits

Author SHA1 Message Date
Francis Gulotta
8d95d6f532 Fix an error in listUnix where we were filtering improperly (#792) 2016-05-08 22:16:04 -04:00
Francis Gulotta
cf41ef76bd Update the errors for unix to always include the err string and tests for close (#790) 2016-05-06 23:38:17 -04:00
Francis Gulotta
cf678e6f0b Small Update for windows bindings (#785)
- Error with the provided com port name instead of the mess we use under the hood to talk to the apis
 - update _snprintf calls to _snprintf_s as the former is depreciated 
 - Add a binding test for bad ports
2016-05-05 10:30:50 -04:00
Francis Gulotta
9f9693cb15 Update cli tools (#776)
- Better argument handling
 - Switch to commander as optimist is deprecated 
 - more output formats for serial port list
 - give serialportterm a list option
2016-05-01 18:19:54 -04:00
Francis Gulotta
566a8d48e9 Move some tests around 2016-05-01 16:53:49 -04:00
Francis Gulotta
1bd3e06c58 SerialportList updates (#761)
- Errors are now consistent across platforms
 - List is now completely async and promise ready
 - Test the bindings abstraction not the bindings itself
2016-04-23 12:43:31 -04:00
Francis Gulotta
6945217c0b Isolate the bindings (#755)
- Test requiring the library as part of the build processes on all platforms
 - move all js code into ./lib
 - move all the easy stuff into ./lib/bindings the rest will bring breaking changes probably
2016-04-15 23:54:58 -04:00
Francis Gulotta
8342d1725c Add support for bluetooth devices /dev/rfcomm (#742) 2016-04-08 12:50:56 -04:00
Francis Gulotta
156e405bbc Define, document, and test flow control and setting port flags (#726)
We had ambiguous behavior and documentation around these settings and functions, this preserves all of the previous behavior and defines it in documentation and tests. This is a step towards separating out and cleaning up user supplied options to the constructor.
2016-04-08 11:44:18 -04:00
Francis Gulotta
39946c4bc0 Make the output of .list undefined if it’s an empty string (#740)
Add some tests to start defining the bindings.
2016-04-08 11:18:37 -04:00
Francis Gulotta
540a96015c Add npm run stress to run stress tests
- Fixed the write memory leak test

 - failed attempt at a open close memory leak test



Closes #602
2016-04-03 21:21:26 -04:00
Francis Gulotta
a9a5d865f6 Test port open errors 2016-04-03 18:31:22 -04:00
Francis Gulotta
abc3c19565 Test & Fix a race condition when closing a port & trying to do anything
- isOpen() now pays attention to if we're in the middle of closing



Our faux state machine for opening and closing consists for 4 states

 - closed

 - opening

 - open

 - closing



Currently we only really care about if we're in open or not because that's when all our operations can happen. `#open` and `#close` care if they're opening or closing.
2016-04-03 01:05:41 -04:00
Rick Waldron
a79ff28d88 Dependency cleanup (quick pass)
- Eliminates use of node-pre-gyp as an actual module dependency (just a package dependency, this might even be just a devDep now?)

- Reduces 5 blocking fs operations to 1



Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
2016-04-02 20:29:02 -04:00
Francis Gulotta
836064abe3 Fix double open
- Test for and stop the double opening of ports
 - More tests around opening and disconnecting
 - Fix mock darwin hardware to be async and hold off zalgo
 - Fix broken tests that counted on non async darwin hardware
2016-04-02 18:44:22 -04:00
Francis Gulotta
77851e2e75 Closing a port is better tested & correctly reports isOpen in it’s event
- Ports correctly respond to `isOpen` during a close event
 - cleanup some assertions
 - if a CI has a port to test with, open and close it


Bonus
 - Appveyor seems to think if you have a `&` in your commit message you’re trying to run a command
2016-03-31 15:20:07 -04:00
Francis Gulotta
4fbf6d923b Integration Tests!
We weren’t running these except on node v0.10 now we can! One day we might have a virtual serial port on each CI environment and we can test a lot more. That day isn’t today.

 - add another test for listing ports
 - mock some more things in our mock binding, specially the real bindings
2016-03-30 23:19:59 -04:00
Francis Gulotta
eed507969f Merge pull request #708 from voodootikigod/listunix-refactor
Move listUnix to its own module
2016-03-30 21:16:26 -04:00
Francis Gulotta
c93fb3b81f Move listUnix to its own module
- Refactor to fix bugs 
 - Remove the path behind `udevadm` as it’s not always in the same place but it’s so far it is always in the path
 - Tests listUnix, (`pnpId` assumes a lot about `udevadm` =( )
 - Adds `ttyMDF` to the list of serial ports for “High Speed UART device of Intel Medfield platform”
 - turn down the verboseness on appveyor nam installs
 - upgrade sandboxed-module for windows support

Fixes #650,  #651, #634, #697 and #621
2016-03-30 18:51:47 -04:00
Francis Gulotta
cf2f461127 linting binaries, cleaning up tests, add a doc 2016-03-30 11:27:25 -04:00
Linus Wallgren
090b26b58b Bugfixes around JS handling of file descriptors
This patch combines #586 and #686

 - A closed serialport now uses fd = null
 - Emulate a proper fd in mock hardware
 - Instead of using the device path as the file descriptor, use a generated
integer as the fd.

This have to use a starting fd of 1 as there are bugs when the fd is 0.
The open(2) manpage states that the file descriptor will be a small
nonnegative integer.

Checking if the fd is falsey leads to the incorrect classification of the
fd 0 as invalid. That is not the case, open(2) specifies the fd as "a
small, nonnegative integer".

This also adds tests for all the cases where the fd was previously
incorrectly considered invalid, which required adding three more methods
to the mock-hardware (update, set and drain).

This solves issue #472
2016-03-28 19:41:34 -04:00
Francis Gulotta
c2c424c620 Switch to eslint and fixup a lot of listing issues.
There are not a ton of open PRs that would be effected by this, I think it's a good time to go ahead and merge this right away.
2016-03-27 15:03:15 -04:00
Chris Williams
3baee62981 Merge branch 'init-test' of https://github.com/jacobrosenthal/node-serialport into jacobrosenthal-init-test 2015-05-07 11:04:40 -04:00
Jacob Rosenthal
10d43fc8cc test explcitly for node 10, hacky fix for #492 2015-04-10 16:24:54 -07:00
Valery De Smedt
d01e9a2ea1 Fix comparison operators 2015-03-26 18:30:47 +01:00
Valery De Smedt
772492aa3d byteDelimiter parser
emit row data base on a delimiter
2015-03-26 16:36:16 +01:00
Chris Williams
06f723df65 Merge pull request #452 from jacobrosenthal/emittests
Missing emits for close and disconnect
2015-01-21 09:25:03 -05:00
Chris Williams
255c8be767 Merge pull request #450 from jacobrosenthal/errortests
Needed tests on operating on ports that are not open
2015-01-21 09:24:50 -05:00
Jacob Rosenthal
d08a43bfed test close and disconnect emit 2015-01-20 23:19:05 -07:00
Jacob Rosenthal
8e93e353f9 stopbits, parity, flowcontrol invalid tests 2015-01-20 23:03:40 -07:00
Jacob Rosenthal
69d0382a51 tests if you try to operate on a non open port 2015-01-20 22:52:37 -07:00
Francis Gulotta
87d3fa08a7 Use the jshintrc file for grunt and cleanup some issues. 2015-01-21 00:13:48 -05:00
Jacob Rosenthal
d99c547928 need a test to see that open event was fired 2015-01-20 19:41:15 -07:00
Rick Waldron
e1638cee36 Emit error on serialport when explicit handler present. Fixes gh-369
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
2014-08-10 15:56:00 -04:00
Chris Williams
a3c70aa95e Update. 2014-08-03 10:31:28 -04:00
Chris Williams
0061743372 jshint fix. 2014-08-03 10:29:14 -04:00
Chris Williams
f37144ca12 Fixing test to deal with node unstable issue. 2014-08-03 10:26:40 -04:00
Francis Gulotta
449a1b30d5 ByteLength Parser: Emit data every N bytes
Made it for fun to address #356, also fixed existing tests as they weren’t actually throwing errors. Fortunately the parsers were working perfectly.
2014-07-12 20:38:09 -04:00
Francis Gulotta
c3c2e4fe34 actually initialize the serialport without mocks in tests 2014-01-23 20:13:15 -05:00
Francis Gulotta
6ddd7ecfe1 Merge pull request #277 from voodootikigod/move-parsers
Move parsers to their own file because they don't rely on anything else.
2013-12-26 21:12:55 -08:00
Francis Gulotta
a7b22dffeb Merge pull request #279 from voodootikigod/optionalfunctions
don't set options on a callback open function
2013-12-17 13:17:10 -08:00
Francis Gulotta
c796fe7dce don't set options on a callback open function 2013-12-14 19:54:32 -05:00
Francis Gulotta
4f19804d24 Added some basic close event tests - removed some code around read streams that isn't used anymore 2013-12-14 16:54:34 -05:00
Francis Gulotta
712914c9ba Move parsers to their own file because they don't rely on anything else. 2013-12-14 16:38:01 -05:00
Francis Gulotta
dd642c95d4 Add a JS disconnect test and mock hardware disconnect command. 2013-12-12 09:27:24 -05:00
Francis Gulotta
1b831f079f Add some basic read tests 2013-11-12 15:37:32 -05:00
Francis Gulotta
c9495a713c Move the read test into serialport-basic. Make use of sinon sandboxes, refactor the mock serial-port-binding into linux hardware for "remote control" 2013-11-12 13:54:34 -05:00
Adriano Raiano
e07ec47312 Rename read to read.js 2013-10-31 18:28:10 +01:00
Adriano Raiano
17a2634bb4 added read tests 2013-10-30 15:37:06 +01:00
Francis Gulotta
d589347550 Fix spelling and whitespace 2013-10-29 15:57:20 -04:00