fix: only set readableObjectMode in recognize-stream if not present#907
fix: only set readableObjectMode in recognize-stream if not present#907dpopp07 merged 1 commit intowatson-developer-cloud:masterfrom MasterOdin:patch-2
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) |
dpopp07
left a comment
There was a problem hiding this comment.
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 testpasses (tip:npm run autofixcan correct most style issues)This fixes a bug in
lib/recognize-stream.tswhere 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
readableObjectModeoption 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.readableObjectModecan betrue / undefinedwhile on Node 12,this.readableObjectModecan betrue / false. I'm not sure if you folks would want to break backwards compatibility (slightly) and makethis.readableObjectModebetrue / falseto 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.