★ wanayoo — archive 1999 https://github.com/nodejs/node/pull/24482Nouvelle recherche | Portail wanayoo
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-child-process-env to use arrow functions #24482

Closed
wants to merge 3 commits into from

Conversation

@sagirk
Copy link
Member

sagirk commented Nov 19, 2018 •

In test/parallel/test-child-process-env.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
@gireeshpunathil

This comment has been minimized.

@sagirk

This comment has been minimized.

Copy link
Member Author

sagirk commented Nov 20, 2018 •

@thefourtheye The build failed, seemingly because of the last change.

How do I go about fixing it? Undoing the common.mustCall wrapper will fix it, but I want to understand if there's something else that we can do here.

image

@Trott
Copy link
Member

Trott left a comment

Please remove the use of common.mustCall() as an exit event handler. Thanks!

sagirk added some commits Nov 19, 2018

test: refactor test-child-process-env to use arrow functions
In `test/parallel/test-child-process-env.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 sagirk force-pushed the sagirk:refactor/test-child-process-env branch from a70411b to dc4bdab Nov 21, 2018

@sagirk

This comment has been minimized.

Copy link
Member Author

sagirk commented Nov 21, 2018

@Trott Done. Build passed. PTAL.

@gireeshpunathil

This comment has been minimized.

@gireeshpunathil

This comment has been minimized.

Copy link
Member

gireeshpunathil commented Nov 22, 2018

windows-fanned test unrelated:

03:38:14 not ok 284 parallel/test-trace-events-worker-metadata
03:38:14   ---
03:38:14   duration_ms: 8.340
03:38:14   severity: fail
03:38:14   exitcode: 1
03:38:14   stack: |-
03:38:14     assert.js:351
03:38:14         throw err;
03:38:14         ^
03:38:14     
03:38:14     AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:
03:38:14     
03:38:14       assert(traces.some((trace) =>
03:38:14         trace.cat === '__metadata' && trace.name === 'thread_name' &&
03:38:14           trace.args.name === 'WorkerThread 1'))
03:38:14     
03:38:14         at fs.readFile.common.mustCall (/home/iojs/build/workspace/node-test-binary-arm/test/parallel/test-trace-events-worker-metadata.js:26:7)
03:38:14         at /home/iojs/build/workspace/node-test-binary-arm/test/common/index.js:346:15
03:38:14         at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:54:3)
03:38:14   ...
@gireeshpunathil

This comment has been minimized.

Copy link
Member

gireeshpunathil commented Nov 22, 2018

so all is good, just waiting for @Trott to re-review and dismiss the change request.

@Trott Trott dismissed their stale review Nov 26, 2018

requested changes applied

@Trott

This comment has been minimized.

Copy link
Member

Trott commented Nov 28, 2018

@gireeshpunathil

This comment has been minimized.

Copy link
Member

gireeshpunathil commented Nov 28, 2018

landed as 484ad3b

gireeshpunathil added a commit that referenced this pull request Nov 28, 2018

test: use arrow function
In `test/parallel/test-child-process-env.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.

PR-URL: #24482
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>

targos added a commit that referenced this pull request Nov 28, 2018

test: use arrow function
In `test/parallel/test-child-process-env.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.

PR-URL: #24482
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>

@sagirk sagirk deleted the sagirk:refactor/test-child-process-env branch Nov 30, 2018

@BridgeAR BridgeAR referenced this pull request Dec 5, 2018

Merged

v11.4.0 proposal #24854

4 of 4 tasks complete

refack added a commit to refack/node that referenced this pull request Jan 14, 2019

test: use arrow function
In `test/parallel/test-child-process-env.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.

PR-URL: nodejs#24482
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>

BethGriggs added a commit that referenced this pull request Feb 12, 2019

test: use arrow function
In `test/parallel/test-child-process-env.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.

PR-URL: #24482
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>

@BethGriggs BethGriggs referenced this pull request Feb 12, 2019

Merged

v10.15.3 proposal #26063

rvagg added a commit that referenced this pull request Feb 28, 2019

test: use arrow function
In `test/parallel/test-child-process-env.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.

PR-URL: #24482
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.