Skip to content

response's close event not being triggered #8613

Closed
@canastro

Description

@canastro
  • Version: 7.0.0-pre
  • Platform: Darwin 15.2.0 Darwin Kernel Version 15.2.0: Fri Nov 13 19:56:56 PST 2015; root:xnu-3248.20.55~2/RELEASE_X86_64 x86_64
  • Subsystem: test, lib

While attending the code and learn in the Node Interactive at Amesterdam we we’re giving the task of cleaning up some of the unit tests to follow the latest guidelines.

In the file test/parallel/test-http-agent-destroyed-socket.js once I replaced:

response.once('close’, callback)

for

response.once('close’, common.mustCall(callback))

The unit tests started to fail with the following error message:

Mismatched <anonymous> function calls. Expected 1, actual 0.
    at IncomingMessage.response.on (/Users/ricardocanastro/dev/node/test/parallel/test-http-agent-destroyed-socket.js:48:37)

In order to simulate the issue I created the following gist:
https://gist.github.com/canastro/36ed5066d2516c425498884123cb0824
If you run this, you'll see that 'response:: close' never gets printed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    httpIssues or PRs related to the http subsystem.testIssues and PRs related to the tests.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions