Commit graph

122 commits

Author SHA1 Message Date
Francis Gulotta
c47b924aa1 Baudrate.250000 (#1239)
* Test for 250k baud rate
2017-07-16 22:42:51 -04:00
Francis Gulotta
61e23d0907 [all] Have drain wait for pending JS write operations before calling system drain
This should allow drain to be a lot easier to use.

Bonus:
- More logging!
- Bluebird in tests with it's great long stack traces!
2017-07-16 22:05:58 -04:00
Francis Gulotta
b822721855 refactor some test logic 2017-07-16 16:21:08 -04:00
Francis Gulotta
9c67ee2a43 [unix] Move setting up the baudrate to the end of the open()
- Test 1000000 baud
2017-07-15 13:06:44 -04:00
Francis Gulotta
ee7315f59c Make the mock bindings example work properly and the bindings easier to use 2017-07-15 12:24:33 -04:00
Francis Gulotta
2045d8542f Remove the disconnect event 2017-07-09 21:54:53 -04:00
Francis Gulotta
1888efc944 Ensure flushing doesn't cause a read error which closes the port 2017-07-09 21:25:02 -04:00
Francis Gulotta
2ed7b119d0 Test flushing data
- [unix] small changes to flushing data during port open and setup to prevent bad data
- [all] mock binding flush now works
- cleanup on mock-binding pending reads
- add `serialport-repl` as a bin and npm command
2017-07-09 21:25:02 -04:00
Francis Gulotta
6455ecbb51 [unix] New read/write subsystem (#1212)
This has always been the dream. Use `fs.read` and `fs.write` to do reading and writing. To make that happen I've created a cross platform `Poller` object that notifies us once on `readable` and `writable` states.

- Reduce large write cpu usage from 100% to 1-2%
- Replace ReadPoller with a multi purpose poller because you can only have a single uv_poll_t on a fd at a time because reasons
- Experimented with doing this all in c++, maybe there are gains to doing that but I'd never finish.
- Some unrelated eslint changes
- Arduino echo should just echo, writing random bytes was messing it up
- use a file to disable tests in envs
- read and write errors can trigger disconnects
- disconnect event only happens if there are listeners, otherwise error events will be triggered
- a disconnect during write will always have a write error too
- win32 bindings seem to only trigger disconnects on writes
2017-07-05 09:12:31 -04:00
greenkeeper[bot]
06543aa317 Update dependencies to enable Greenkeeper 🌴 (#1195)
* chore(package): update dependencies
* docs(readme): add Greenkeeper badge
* Ignore package-lock.json and fix linting
* Work around some issues with ci's
* fix windows coverage
2017-06-18 22:09:13 -04:00
Francis Gulotta
ab4b55c0a0 Pull README edits into the template and JS Doc
Updated the generated section of the docs but not all changes can be preserved.
2017-06-18 21:24:51 -04:00
Francis Gulotta
5f53a45cae Buffer upgrades (#1168)
* upgrade to non deprecated buffer methods
* Don't lint on node 4 as it's now broken

I really wish packages would keep things working on LTS platforms.
2017-05-14 12:58:56 -04:00
Francis Gulotta
a049538270 Upgrade linters, edit for clarity 2017-03-16 22:24:53 -04:00
Jessica Quynh Tran
f60eb195af add regex stream parser and tests (#1093)
* add regex stream parser and tests
2017-02-19 19:46:52 -05:00
Francis Gulotta
414057c4dc Promised based bindings.
- Base bindings class to extend
- Move docs to base binding
- Make all bindings classes
- Ditch push bindings because it doesn't make anything cleaner
2017-01-10 23:02:51 -05:00
Francis Gulotta
e588e88fa7 Feature flags for disabling tests
Use feature flags instead of platform tags when disabling tests. This also preps us for virtual ports which don't support everything.
2017-01-07 19:05:35 -05:00
Francis Gulotta
a98e92c898 Switch to arrow functions when possible
- Rename the linux-list test
- restore the require cache after proxyquire
2017-01-07 18:29:55 -05:00
Francis Gulotta
c40c24972a Reorganize files for clarity
- Move Parsers into a directory
- Move Bindings into a directory
- Add a linter for require calls
2017-01-07 00:23:20 -05:00
Francis Gulotta
1cc455aff5 Test flush on parsers
More es6 cleanup
2016-12-25 17:54:19 -05:00
Francis Gulotta
a1636066bf Improve test coverage and small cleanup
- freeze default objects
- enforce and test required arguments
2016-12-25 16:59:46 -05:00
Francis Gulotta
8187218d4b Cover passing bad input to update and fix docs 2016-12-24 23:20:50 -05:00
Francis Gulotta
569bb58ea2 Fix canceling of read poller 2016-12-23 18:50:37 -05:00
Francis Gulotta
c15eb841cb linting for es6 (#1040)
* linting for es6
2016-12-21 21:09:43 -05:00
Francis Gulotta
efee0cd46f remove pre 4.0 stuff 2016-12-20 20:56:11 -05:00
Francis Gulotta
1643dd1c81 Remove Polyfills and upgrade node-pre-gyp
- Remove object.assign
- Remove buffer-indexof
- Remove lie
2016-12-12 22:26:47 -05:00
Michael Orenstein
e442963e32 Added electron builds to travis and appveyor. 2016-11-18 20:54:30 +10:00
Francis Gulotta
27788ceae9 Stop autoOpening on next tick
This allows for catching TypeErrors when open gets called

 - Change MockBinding to properly throw and return errors on open
 - Enforce bindings throwing on empty string paths
2016-11-06 00:23:29 -04:00
Francis Gulotta
5306b7f5e1 Give anonymous functions names for debugging
Also throw in some manual testing scripts.
2016-11-05 23:56:22 -04:00
Francis Gulotta
672e8319c3 Conform to NodeJS error message formats (#998)
https://github.com/nodejs/node/pull/3374
2016-11-04 23:29:07 -04:00
Francis Gulotta
39d0103937 Streams rewrite
This is a major change.  To reading, the poller and the bindings layer, there isn’t a great way to do this piecemeal. The goal here is to make bindings a plugin layer, our c++ bindings isolated and tested, and make Serialport a streams object.

- Move all bindings into platform specific modules DarwinBinding LinuxBinding, and WindowsBinding
- Separate out the bindings from the SerialPort class so it can be required by itself.
- Provide mock bindings as a tested first class bindings layer
- Mixin stream methods with `pushBindingWrap`, inspired from fs.readStream
- All integration tests now require an Arduino 
- Ditch sandboxed modules as we don't need to be that heavy handed to test anymore

TODO

- windows binding
- performance test
- memory leak test
- 🎉
2016-11-04 21:03:35 -04:00
Francis Gulotta
9f8a359a86 Test changes
- Increase code coverage of parsers 
- Ask mocha to fail fast
- Auto detect arduino for tests
2016-11-04 17:26:41 -04:00
Francis Gulotta
23de171055 Do error checking when getting modem control flags 2016-10-21 21:35:50 -04:00
Francis Gulotta
0d757fd72c Merge pull request #967 from jgillick/master
Get modem status bits (CTS, DSR, DCD)
2016-10-21 17:50:49 -04:00
jgillick
598c8e9ec8 Add basic tests 2016-10-21 00:07:41 -07:00
Francis Gulotta
72fc5b2597 rename ReadLineParser to ReadlineParser
matches gnu and nodejs conventions for `readline`
2016-10-13 02:26:05 +01:00
Andrew Koroluk
672abb4936 depreciated -> deprecated 2016-10-11 01:15:53 -04:00
Francis Gulotta
d2bb973382
Transform parsers into streams
Parsers are now transform streams! I'm not 100% convinced this is easier to use but it is more clear about the mechanics. I think that might make it worthwhile. It also opens up a clear example to how to make your own parser.
2016-09-08 19:18:36 -04:00
Francis Gulotta
cf822fcaf4 some more linting rules so we're consistent (#909) 2016-08-16 21:50:26 -04:00
Francis Gulotta
3247987c1f Allow opening after an open error. (#910)
fixes #908
2016-08-16 21:49:35 -04:00
Francis Gulotta
3400822e80 [unix] Flush now gives errors and flushes tx and rx (#900)
- Bonus less structs as many functions return nothing or error
2016-08-08 15:13:04 -04:00
Francis Gulotta
b3404072cf
Test the write non binding code a bit more 2016-08-08 00:35:23 -04:00
Francis Gulotta
5616664ed6 Change isOpen() to a propterty (#899) 2016-08-06 21:51:56 -04:00
Francis Gulotta
3aafa77e2c Remove lowercase options and properly define .path (#898) 2016-08-06 20:26:49 -04:00
arve0
c5c7440415 parsers.byteDelimiter: compare arrays instead of increasing nextDelimIndex 2016-07-28 14:37:06 +02:00
arve0
5249f5c02b parsers.byteDelimiter: add test, emit only on following delimiters
Example:

```
var parser = byteDelimiter([0,0]);

parser(emit, new Buffer('\0hello\0world\0\0');
```

Expected: `emit` should be called once, upon `\0\0` with whole string.
What happens: `emit` is called twice, with `\0hello\0` and `world\0\0`.
2016-07-28 13:37:21 +02:00
Francis Gulotta
d0c64555c0 Choose a different invalid FD (#883)
that hopefully throws an error on our new ci
2016-07-26 07:45:36 -04:00
Francis Gulotta
dcfe2ab4ee Switch up testing infrastructure (#881)
- npm test now runs everything but stress tests
 - TEST_PORT is optional but now requires an arduino, the travis provided OS X serial port wasn't worth it
 - do some improvements to coverage
 - Drop grunt for file size and complexity
 - Eslint has dropped 0.10

I don't think Istanbul can detect coverage on sandboxed modules like our mocked bindings. Moving to an isolated binding will improve this situation.

I also don't think coveralls is working on travis
2016-07-24 22:20:23 -04:00
Francis Gulotta
4c55b57ffb Drop Sinon Chai and refactor some tests (#868) 2016-07-13 00:42:56 -04:00
Francis Gulotta
36be232bb1 Cleanup disconnect path (#855)
- make the disconnect path more consistent
 - call callback in the context of the port
2016-06-16 00:21:42 -04:00
Francis Gulotta
c84c9a22c9 Cleanup some callbacks (#851)
- remove the dataCallback option
 - remove the disconnectedCallback option
 - call callback in the context of the port
2016-06-14 23:12:44 -04:00