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: use arrow functions in async-hooks tests #30137

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/async-hooks/test-disable-in-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const fs = require('fs');
let nestedCall = false;

async_hooks.createHook({
init: common.mustCall(function() {
init: common.mustCall(() => {
nestedHook.disable();
if (!nestedCall) {
nestedCall = true;
Expand Down
8 changes: 4 additions & 4 deletions test/async-hooks/test-graph.http.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ const http = require('http');
const hooks = initHooks();
hooks.enable();

const server = http.createServer(common.mustCall(function(req, res) {
const server = http.createServer(common.mustCall((req, res) => {
res.end();
this.close(common.mustCall());
server.close(common.mustCall());
}));
server.listen(0, common.mustCall(function() {
server.listen(0, common.mustCall(() => {
http.get({
host: '::1',
family: 6,
port: server.address().port
}, common.mustCall());
}));

process.on('exit', function() {
process.on('exit', () => {
hooks.disable();

verifyGraph(
Expand Down
4 changes: 2 additions & 2 deletions test/async-hooks/test-graph.pipeconnect.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ tmpdir.refresh();
const hooks = initHooks();
hooks.enable();

net.createServer(function(c) {
const server = net.createServer((c) => {
c.end();
this.close();
server.close();
}).listen(common.PIPE, common.mustCall(onlisten));

function onlisten() {
Expand Down
4 changes: 2 additions & 2 deletions test/async-hooks/test-nexttick-default-trigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ hooks.enable();

const rootAsyncId = async_hooks.executionAsyncId();

process.nextTick(common.mustCall(function() {
process.nextTick(common.mustCall(() => {
assert.strictEqual(async_hooks.triggerAsyncId(), rootAsyncId);
}));

process.on('exit', function() {
process.on('exit', () => {
hooks.sanityCheck();

const as = hooks.activitiesOfTypes('TickObject');
Expand Down
4 changes: 2 additions & 2 deletions test/async-hooks/test-pipeconnectwrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ let pipe1, pipe2;
let pipeserver;
let pipeconnect;

net.createServer(common.mustCall(function(c) {
const server = net.createServer(common.mustCall((c) => {
c.end();
this.close();
server.close();
process.nextTick(maybeOnconnect.bind(null, 'server'));
})).listen(common.PIPE, common.mustCall(onlisten));

Expand Down
4 changes: 2 additions & 2 deletions test/async-hooks/test-queue-microtask.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ hooks.enable();

const rootAsyncId = async_hooks.executionAsyncId();

queueMicrotask(common.mustCall(function() {
queueMicrotask(common.mustCall(() => {
assert.strictEqual(async_hooks.triggerAsyncId(), rootAsyncId);
}));

process.on('exit', function() {
process.on('exit', () => {
hooks.sanityCheck();

const as = hooks.activitiesOfTypes('Microtask');
Expand Down