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

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

Closed

Commits on Nov 19, 2018

  1. test: refactor test-http-write-empty-string to use arrow functions

    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.
    sagirk committed Nov 19, 2018
    Configuration menu
    Copy the full SHA
    5374334 View commit details
    Browse the repository at this point in the history

Commits on Nov 20, 2018

  1. test: replace this with the object that it refers to

    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`.
    sagirk committed Nov 20, 2018
    Configuration menu
    Copy the full SHA
    bffdf1d View commit details
    Browse the repository at this point in the history
  2. test: remove space before function parentheses

    Fix ESLint complaint: "28:42 Unexpected space before function
    parentheses space-before-function-paren".
    sagirk committed Nov 20, 2018
    Configuration menu
    Copy the full SHA
    8673f80 View commit details
    Browse the repository at this point in the history