Skip to content

test: refactor test-http-write-empty-string to use arrow functions - #24483

Closed
sagirk wants to merge 3 commits into
nodejs:masterfrom
sagirk:refactor/test-http-write-empty-string
Closed

test: refactor test-http-write-empty-string to use arrow functions#24483
sagirk wants to merge 3 commits into
nodejs:masterfrom
sagirk:refactor/test-http-write-empty-string

Conversation

@sagirk

@sagirk sagirk commented Nov 19, 2018

Copy link
Copy Markdown
Contributor

In test/parallel/test-http-write-empty-string.js, callbacks use
anonymous closure functions. It is safe to replace them with arrow
functions since these callbacks don't contain references to this,
super or arguments. This results in shorter functions.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

In `test/parallel/test-http-write-empty-string.js`, callbacks use
anonymous closure functions. It is safe to replace them with arrow
functions since these callbacks don't contain references to `this`,
`super` or `arguments`. This results in shorter functions.
@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to Node.js core tests and test infrastructure. label Nov 19, 2018
Comment thread test/parallel/test-http-write-empty-string.js Outdated
@gireeshpunathil gireeshpunathil added the code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. label Nov 19, 2018
In `test/parallel/test-http-write-empty-string.js`, the callback passed
to `http.createServer` contains a reference to `this`. Since the object
referenced by `this` doesn't pre-exist, revert the arrow function to an
anonymous closure function as a callback.

Similarly, the callback passed to `server.listen` too contains a
reference to `this`. However, in this case, `this` resolves to a
pre-existing object `server`. Therefore, it is safe to use an arrow
function as a callback as long as `this` is replaced with `server`.
Fix ESLint complaint: "28:42 Unexpected space before function
parentheses space-before-function-paren".
@gireeshpunathil

Copy link
Copy Markdown
Member

@Trott Trott added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Nov 20, 2018
@Trott

Trott commented Nov 21, 2018

Copy link
Copy Markdown
Member

👍 here to fast-track.

@Trott Trott added the fast-track PRs proposed for a shorter-than-standard waiting period before landing. label Nov 21, 2018
Trott pushed a commit to Trott/io.js that referenced this pull request Nov 21, 2018
In `test/parallel/test-http-write-empty-string.js`, callbacks use
anonymous closure functions. Replace them with arrow functions.

PR-URL: nodejs#24483
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@Trott

Trott commented Nov 21, 2018

Copy link
Copy Markdown
Member

Landed in e610685

@Trott Trott closed this Nov 21, 2018
targos pushed a commit that referenced this pull request Nov 21, 2018
In `test/parallel/test-http-write-empty-string.js`, callbacks use
anonymous closure functions. Replace them with arrow functions.

PR-URL: #24483
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
rvagg pushed a commit that referenced this pull request Nov 28, 2018
In `test/parallel/test-http-write-empty-string.js`, callbacks use
anonymous closure functions. Replace them with arrow functions.

PR-URL: #24483
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@BridgeAR BridgeAR mentioned this pull request Dec 5, 2018
4 tasks
codebytere pushed a commit that referenced this pull request Jan 13, 2019
In `test/parallel/test-http-write-empty-string.js`, callbacks use
anonymous closure functions. Replace them with arrow functions.

PR-URL: #24483
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
refack pushed a commit to refack/node that referenced this pull request Jan 14, 2019
In `test/parallel/test-http-write-empty-string.js`, callbacks use
anonymous closure functions. Replace them with arrow functions.

PR-URL: nodejs#24483
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@codebytere codebytere mentioned this pull request Jan 15, 2019
codebytere pushed a commit that referenced this pull request Jan 29, 2019
In `test/parallel/test-http-write-empty-string.js`, callbacks use
anonymous closure functions. Replace them with arrow functions.

PR-URL: #24483
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. fast-track PRs proposed for a shorter-than-standard waiting period before landing. test Issues and PRs related to Node.js core tests and test infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants