Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 37c70ee

Browse filesBrowse files
GaryGSCtargos
authored andcommitted
test: use arrow functions in async-hooks tests
Convert all anonymous callback functions in `test/async-hooks/*.js` to use arrow functions. `writing-tests.md` states to use arrow functions when appropriate. PR-URL: #30137 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent b5c7dad commit 37c70ee
Copy full SHA for 37c70ee

File tree

Expand file treeCollapse file tree

6 files changed

+13
-13
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

6 files changed

+13
-13
lines changed
Open diff view settings
Collapse file

‎test/async-hooks/test-disable-in-init.js‎

Copy file name to clipboardExpand all lines: test/async-hooks/test-disable-in-init.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const fs = require('fs');
77
let nestedCall = false;
88

99
async_hooks.createHook({
10-
init: common.mustCall(function() {
10+
init: common.mustCall(() => {
1111
nestedHook.disable();
1212
if (!nestedCall) {
1313
nestedCall = true;
Collapse file

‎test/async-hooks/test-graph.http.js‎

Copy file name to clipboardExpand all lines: test/async-hooks/test-graph.http.js
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ const http = require('http');
1111
const hooks = initHooks();
1212
hooks.enable();
1313

14-
const server = http.createServer(common.mustCall(function(req, res) {
14+
const server = http.createServer(common.mustCall((req, res) => {
1515
res.end();
16-
this.close(common.mustCall());
16+
server.close(common.mustCall());
1717
}));
18-
server.listen(0, common.mustCall(function() {
18+
server.listen(0, common.mustCall(() => {
1919
http.get({
2020
host: '::1',
2121
family: 6,
2222
port: server.address().port
2323
}, common.mustCall());
2424
}));
2525

26-
process.on('exit', function() {
26+
process.on('exit', () => {
2727
hooks.disable();
2828

2929
verifyGraph(
Collapse file

‎test/async-hooks/test-graph.pipeconnect.js‎

Copy file name to clipboardExpand all lines: test/async-hooks/test-graph.pipeconnect.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ tmpdir.refresh();
1212
const hooks = initHooks();
1313
hooks.enable();
1414

15-
net.createServer(function(c) {
15+
const server = net.createServer((c) => {
1616
c.end();
17-
this.close();
17+
server.close();
1818
}).listen(common.PIPE, common.mustCall(onlisten));
1919

2020
function onlisten() {
Collapse file

‎test/async-hooks/test-nexttick-default-trigger.js‎

Copy file name to clipboardExpand all lines: test/async-hooks/test-nexttick-default-trigger.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ hooks.enable();
1414

1515
const rootAsyncId = async_hooks.executionAsyncId();
1616

17-
process.nextTick(common.mustCall(function() {
17+
process.nextTick(common.mustCall(() => {
1818
assert.strictEqual(async_hooks.triggerAsyncId(), rootAsyncId);
1919
}));
2020

21-
process.on('exit', function() {
21+
process.on('exit', () => {
2222
hooks.sanityCheck();
2323

2424
const as = hooks.activitiesOfTypes('TickObject');
Collapse file

‎test/async-hooks/test-pipeconnectwrap.js‎

Copy file name to clipboardExpand all lines: test/async-hooks/test-pipeconnectwrap.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ let pipe1, pipe2;
1717
let pipeserver;
1818
let pipeconnect;
1919

20-
net.createServer(common.mustCall(function(c) {
20+
const server = net.createServer(common.mustCall((c) => {
2121
c.end();
22-
this.close();
22+
server.close();
2323
process.nextTick(maybeOnconnect.bind(null, 'server'));
2424
})).listen(common.PIPE, common.mustCall(onlisten));
2525

Collapse file

‎test/async-hooks/test-queue-microtask.js‎

Copy file name to clipboardExpand all lines: test/async-hooks/test-queue-microtask.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ hooks.enable();
1111

1212
const rootAsyncId = async_hooks.executionAsyncId();
1313

14-
queueMicrotask(common.mustCall(function() {
14+
queueMicrotask(common.mustCall(() => {
1515
assert.strictEqual(async_hooks.triggerAsyncId(), rootAsyncId);
1616
}));
1717

18-
process.on('exit', function() {
18+
process.on('exit', () => {
1919
hooks.sanityCheck();
2020

2121
const as = hooks.activitiesOfTypes('Microtask');

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.