-
Notifications
You must be signed in to change notification settings - Fork 668
fix: only set readableObjectMode in recognize-stream if not present #907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #907 +/- ##
=========================================
- Coverage 54% 26.3% -27.7%
=========================================
Files 18 18
Lines 4464 4466 +2
Branches 906 907 +1
=========================================
- Hits 2411 1175 -1236
- Misses 2051 3290 +1239
+ Partials 2 1 -1
Continue to review full report at Codecov.
|
Not sure why the integration tests didn't run (which is probably why the code coverage is reported as tanking so much) and not sure if there's anything I can do to get them running on Travis? |
@MasterOdin Thanks for the PR! About the integration tests, yeah I was just noticing that... That is certainly why the coverage is reporting so low, I do not expect that drop when merged 🙂 The credentials are encrypted and shipped with the repo so I don't know why they wouldn't have run. I'll look into that. I will review this today 👍 |
Unfortunately, due to the need for encryption of credentials, it's impossible to have that work for PRs from forks (which makes sense as it prevents me from revealing them and stealing them). It might be helpful to write some words on how to set things up in tests/readme.md, especially the services that require setting them up in some way (e.g Watson Assistant, Discovery) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good! Thanks for the change
That's a good idea, I'll look into that. As far as this:
What would be an example of a user's code that would be rendered incompatible by this change? I think we've accepted |
Yeah, I think I was a bit ambiguous on what I mean. The change doesn't affect what parameters are accepted by the function, but rather just what For example:
On Node 10, this will print node-sdk/lib/recognize-stream.ts Line 139 in 1eb8080
is the only line in which that property gets set on Node 10. |
@MasterOdin Okay, that makes sense - thanks. I think we hold off for now and I merge this PR as is. Feel free to open an issue if you think we should change this in v5. Note though that we will still be supporting Node 10 in v5 so we will need a solution that is compatible with both. |
## [4.2.2](v4.2.1...v4.2.2) (2019-07-12) ### Bug Fixes * only set readableObjectMode in recognize-stream if not present ([#907](#907)) ([155c005](155c005))
🎉 This PR is included in version 4.2.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Checklist
npm test
passes (tip:npm run autofix
can correct most style issues)This fixes a bug in
lib/recognize-stream.ts
where on Node 12 using it would throw the following error:This is because Node 12.3 added a readableObjectMode getter to the Readable stream prototype. This patch changes it such that it now explicitly sets the
readableObjectMode
option before passing it to the Duplex constructor (which in turn gets passed to the Readable constructor).It should be noted that on Node 10 and below (which is how it currently works),
this.readableObjectMode
can betrue / undefined
while on Node 12,this.readableObjectMode
can betrue / false
. I'm not sure if you folks would want to break backwards compatibility (slightly) and makethis.readableObjectMode
betrue / false
to match the new Node 12 signature.I tested these changes locally in a project I'm working on. No tests were added/changed as no unit tests for the class exists, and I guess it's handled indirectly through the integration tests, but I'm not sure how to set that all up.