Skip to content
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

stream.emit('error', err) -> stream.destroy(err) #127

Merged
merged 3 commits into from
Feb 21, 2022

Conversation

vishnureddy17
Copy link
Member

close #126

@mcollina
Copy link
Member

mcollina commented Feb 4, 2022

CI is failing

@vishnureddy17
Copy link
Member Author

@mcollina Hmm, I've fixed most of the failures by adding destroy() to generate.js. I don't really understand why the remaining tests are failing, I think there's some subtle behavior the old tests were assuming that are no longer true.

Any ideas? I've allowed edits by maintainers in case it's a simple thing you're able to spot.

Thanks! 🙂

@mcollina
Copy link
Member

Unfortunately I have no time to debug this change :(

@@ -180,7 +180,6 @@ function testWriteToStreamError (expected, fixture) {
const result = mqtt.writeToStream(fixture, stream)

t.false(result, 'result should be false')
t.end()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically, this test was failing because destroy() emits error asynchronously.

Removing t.end() here is fine because the test will automatically end when two assertions are hit and will fail the test if more than 2 are hit (per the tape documentation)

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@vishnureddy17
Copy link
Member Author

Don't have merge permission :)

@mcollina mcollina merged commit 2d6667a into mqttjs:master Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Call stream.destroy(err) instead of stream.emit('error', err)
2 participants