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

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-botnodejs-github-bot added the test Issues and PRs related to the tests. label Nov 19, 2018
Comment threadtest/parallel/test-http-write-empty-string.js Outdated
@gireeshpunathilgireeshpunathil 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

@TrottTrott added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Nov 20, 2018
@Trott

Copy link
Copy Markdown
Member

👍 here to fast-track.

@TrottTrott added the fast-track PRs that do not need to wait for 48 hours to land. 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

Copy link
Copy Markdown
Member

Landed in e610685

@TrottTrott 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>
@BridgeARBridgeAR 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>
@codebyterecodebytere 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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.code-and-learnIssues related to the Code-and-Learn events and PRs submitted during the events.fast-trackPRs that do not need to wait for 48 hours to land.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@sagirk@gireeshpunathil@Trott@BridgeAR@nodejs-github-bot