mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
test: add trailing commas in async-hooks tests (#45549)
PR-URL: https://github.com/nodejs/node/pull/45549 Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
This commit is contained in:
parent
4f20c882ec
commit
cf46746b8a
@ -72,7 +72,6 @@ globals:
|
||||
|
||||
overrides:
|
||||
- files:
|
||||
- async-hooks/*.js
|
||||
- es-module/*.js
|
||||
- es-module/*.mjs
|
||||
- internet/*.js
|
||||
|
@ -21,7 +21,7 @@ exports.checkInvocations = function checkInvocations(activity, hooks, stage) {
|
||||
|
||||
assert.ok(activity != null,
|
||||
`${stageInfo} Trying to check invocation for an activity, ` +
|
||||
'but it was empty/undefined.'
|
||||
'but it was empty/undefined.',
|
||||
);
|
||||
|
||||
// Check that actual invocations for all hooks match the expected invocations
|
||||
|
@ -27,7 +27,7 @@ class ActivityCollector {
|
||||
ondestroy,
|
||||
onpromiseResolve,
|
||||
logid = null,
|
||||
logtype = null
|
||||
logtype = null,
|
||||
} = {}) {
|
||||
this._start = start;
|
||||
this._allowNoInit = allowNoInit;
|
||||
@ -49,7 +49,7 @@ class ActivityCollector {
|
||||
before: this._before.bind(this),
|
||||
after: this._after.bind(this),
|
||||
destroy: this._destroy.bind(this),
|
||||
promiseResolve: this._promiseResolve.bind(this)
|
||||
promiseResolve: this._promiseResolve.bind(this),
|
||||
});
|
||||
}
|
||||
|
||||
@ -181,7 +181,7 @@ class ActivityCollector {
|
||||
// In some cases (e.g. Timeout) the handle is a function, thus the usual
|
||||
// `typeof handle === 'object' && handle !== null` check can't be used.
|
||||
handleIsObject: handle instanceof Object,
|
||||
handle
|
||||
handle,
|
||||
};
|
||||
this._stamp(activity, 'init');
|
||||
this._activities.set(uid, activity);
|
||||
@ -233,7 +233,7 @@ exports = module.exports = function initHooks({
|
||||
onpromiseResolve,
|
||||
allowNoInit,
|
||||
logid,
|
||||
logtype
|
||||
logtype,
|
||||
} = {}) {
|
||||
return new ActivityCollector(process.hrtime(), {
|
||||
oninit,
|
||||
@ -243,6 +243,6 @@ exports = module.exports = function initHooks({
|
||||
onpromiseResolve,
|
||||
allowNoInit,
|
||||
logid,
|
||||
logtype
|
||||
logtype,
|
||||
});
|
||||
};
|
||||
|
@ -22,7 +22,7 @@ const hooks = initHooks({
|
||||
onbefore,
|
||||
onafter,
|
||||
ondestroy: null, // Intentionally not tested, since it will be removed soon
|
||||
onpromiseResolve
|
||||
onpromiseResolve,
|
||||
});
|
||||
hooks.enable();
|
||||
|
||||
|
@ -12,7 +12,7 @@ const hooked = {};
|
||||
createHook({
|
||||
init(asyncId, type, triggerAsyncId, resource) {
|
||||
hooked[asyncId] = resource;
|
||||
}
|
||||
},
|
||||
}).enable();
|
||||
|
||||
const server = http.createServer((req, res) => {
|
||||
|
@ -13,7 +13,7 @@ const hooked = {};
|
||||
createHook({
|
||||
init(asyncId, type, triggerAsyncId, resource) {
|
||||
hooked[asyncId] = resource;
|
||||
}
|
||||
},
|
||||
}).enable();
|
||||
|
||||
const server = http.createServer((req, res) => {
|
||||
|
@ -6,7 +6,7 @@ const { readFile } = require('fs');
|
||||
const {
|
||||
createHook,
|
||||
executionAsyncResource,
|
||||
AsyncResource
|
||||
AsyncResource,
|
||||
} = require('async_hooks');
|
||||
|
||||
// Ignore any asyncIds created before our hook is active.
|
||||
@ -32,7 +32,7 @@ createHook({
|
||||
if (asyncId >= firstSeenAsyncId) {
|
||||
afterHook(asyncId);
|
||||
}
|
||||
}
|
||||
},
|
||||
}).enable();
|
||||
|
||||
const beforeHook = common.mustCallAtLeast(
|
||||
|
@ -7,7 +7,7 @@ const http = require('http');
|
||||
const asyncLocalStorage = new AsyncLocalStorage();
|
||||
|
||||
const agent = new http.Agent({
|
||||
maxSockets: 1
|
||||
maxSockets: 1,
|
||||
});
|
||||
|
||||
const N = 3;
|
||||
|
@ -18,7 +18,7 @@ function onPropagate(type, store) {
|
||||
}
|
||||
|
||||
const als = new AsyncLocalStorage({
|
||||
onPropagate: common.mustCall(onPropagate, 2)
|
||||
onPropagate: common.mustCall(onPropagate, 2),
|
||||
});
|
||||
|
||||
const myStore = {};
|
||||
@ -40,11 +40,11 @@ als.run(myStore, common.mustCall(() => {
|
||||
assert.throws(() => new AsyncLocalStorage(15), {
|
||||
message: 'The "options" argument must be of type object. Received type number (15)',
|
||||
code: 'ERR_INVALID_ARG_TYPE',
|
||||
name: 'TypeError'
|
||||
name: 'TypeError',
|
||||
});
|
||||
|
||||
assert.throws(() => new AsyncLocalStorage({ onPropagate: 'bar' }), {
|
||||
message: 'The "options.onPropagate" property must be of type function. Received type string (\'bar\')',
|
||||
code: 'ERR_INVALID_ARG_TYPE',
|
||||
name: 'TypeError'
|
||||
name: 'TypeError',
|
||||
});
|
||||
|
@ -17,7 +17,7 @@ const then = common.mustCall((cb) => {
|
||||
|
||||
function thenable() {
|
||||
return {
|
||||
then
|
||||
then,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ const { AsyncLocalStorage } = require('async_hooks');
|
||||
const options = {
|
||||
cert: fixtures.readKey('rsa_cert.crt'),
|
||||
key: fixtures.readKey('rsa_private.pem'),
|
||||
rejectUnauthorized: false
|
||||
rejectUnauthorized: false,
|
||||
};
|
||||
|
||||
tls
|
||||
|
@ -9,14 +9,14 @@ const arg = process.argv[2];
|
||||
switch (arg) {
|
||||
case 'test_init_callback':
|
||||
initHooks({
|
||||
oninit: common.mustCall(() => { throw new Error(arg); })
|
||||
oninit: common.mustCall(() => { throw new Error(arg); }),
|
||||
}).enable();
|
||||
new async_hooks.AsyncResource(`${arg}_type`);
|
||||
return;
|
||||
|
||||
case 'test_callback': {
|
||||
initHooks({
|
||||
onbefore: common.mustCall(() => { throw new Error(arg); })
|
||||
onbefore: common.mustCall(() => { throw new Error(arg); }),
|
||||
}).enable();
|
||||
const resource = new async_hooks.AsyncResource(`${arg}_type`);
|
||||
resource.runInAsyncScope(() => {});
|
||||
@ -25,7 +25,7 @@ switch (arg) {
|
||||
|
||||
case 'test_callback_abort':
|
||||
initHooks({
|
||||
oninit: common.mustCall(() => { throw new Error(arg); })
|
||||
oninit: common.mustCall(() => { throw new Error(arg); }),
|
||||
}).enable();
|
||||
new async_hooks.AsyncResource(`${arg}_type`);
|
||||
return;
|
||||
|
@ -23,7 +23,7 @@ createHook({
|
||||
if (activeId === id) {
|
||||
activeId = -1;
|
||||
}
|
||||
}
|
||||
},
|
||||
}).enable();
|
||||
|
||||
function testNextTick() {
|
||||
@ -33,7 +33,7 @@ function testNextTick() {
|
||||
res.emitDestroy();
|
||||
// nextTick has higher prio than emit destroy
|
||||
process.nextTick(common.mustCall(() =>
|
||||
assert.strictEqual(activeId, res.asyncId()))
|
||||
assert.strictEqual(activeId, res.asyncId())),
|
||||
);
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ function testQueueMicrotask() {
|
||||
res.emitDestroy();
|
||||
// queueMicrotask has higher prio than emit destroy
|
||||
queueMicrotask(common.mustCall(() =>
|
||||
assert.strictEqual(activeId, res.asyncId()))
|
||||
assert.strictEqual(activeId, res.asyncId())),
|
||||
);
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ function testImmediate() {
|
||||
assert.strictEqual(activeId, res.asyncId());
|
||||
res.emitDestroy();
|
||||
setImmediate(common.mustCall(() =>
|
||||
assert.strictEqual(activeId, -1))
|
||||
assert.strictEqual(activeId, -1)),
|
||||
);
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ function testPromise() {
|
||||
res.emitDestroy();
|
||||
// Promise has higher prio than emit destroy
|
||||
Promise.resolve().then(common.mustCall(() =>
|
||||
assert.strictEqual(activeId, res.asyncId()))
|
||||
assert.strictEqual(activeId, res.asyncId())),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -13,11 +13,11 @@ async_hooks.createHook({
|
||||
nestedCall = true;
|
||||
fs.access(__filename, common.mustCall());
|
||||
}
|
||||
}, 2)
|
||||
}, 2),
|
||||
}).enable();
|
||||
|
||||
const nestedHook = async_hooks.createHook({
|
||||
init: common.mustCall(2)
|
||||
init: common.mustCall(2),
|
||||
}).enable();
|
||||
|
||||
fs.access(__filename, common.mustCall());
|
||||
|
@ -20,7 +20,7 @@ if (process.argv[2] === 'child') {
|
||||
[null, undefined, 1, Date, {}, []].forEach((i) => {
|
||||
assert.throws(() => new Foo(i), {
|
||||
code: 'ERR_INVALID_ARG_TYPE',
|
||||
name: 'TypeError'
|
||||
name: 'TypeError',
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -26,7 +26,7 @@ assert.throws(() => {
|
||||
|
||||
assert.strictEqual(
|
||||
new AsyncResource('default_trigger_id').triggerAsyncId(),
|
||||
async_hooks.executionAsyncId()
|
||||
async_hooks.executionAsyncId(),
|
||||
);
|
||||
|
||||
// Create first custom event 'alcazares' with triggerAsyncId derived
|
||||
|
@ -10,7 +10,7 @@ const heartbeatMsg = /heartbeat: still alive/;
|
||||
|
||||
const {
|
||||
newAsyncId, getDefaultTriggerAsyncId,
|
||||
emitInit, emitBefore, emitAfter, emitDestroy
|
||||
emitInit, emitBefore, emitAfter, emitDestroy,
|
||||
} = internal_async_hooks;
|
||||
|
||||
const initHooks = require('./init-hooks');
|
||||
|
@ -30,7 +30,7 @@ const checkOnce = (fn) => {
|
||||
initHooks({
|
||||
onbefore: checkOnce(chkBefore),
|
||||
onafter: checkOnce(chkAfter),
|
||||
allowNoInit: true
|
||||
allowNoInit: true,
|
||||
}).enable();
|
||||
|
||||
async_hooks.emitInit(expectedId, expectedType, expectedTriggerId);
|
||||
|
@ -10,7 +10,7 @@ const heartbeatMsg = /heartbeat: still alive/;
|
||||
|
||||
const {
|
||||
newAsyncId, getDefaultTriggerAsyncId,
|
||||
emitInit, emitBefore, emitAfter, emitDestroy
|
||||
emitInit, emitBefore, emitAfter, emitDestroy,
|
||||
} = internal_async_hooks;
|
||||
|
||||
const initHooks = require('./init-hooks');
|
||||
|
@ -17,7 +17,7 @@ const hooks1 = initHooks({
|
||||
assert.strictEqual(type, expectedType);
|
||||
assert.strictEqual(triggerAsyncId, expectedTriggerId);
|
||||
assert.strictEqual(resource.key, expectedResource.key);
|
||||
})
|
||||
}),
|
||||
});
|
||||
|
||||
hooks1.enable();
|
||||
@ -33,7 +33,7 @@ initHooks({
|
||||
assert.strictEqual(type, expectedType);
|
||||
assert.notStrictEqual(triggerAsyncId, expectedTriggerId);
|
||||
assert.strictEqual(resource.key, expectedResource.key);
|
||||
})
|
||||
}),
|
||||
}).enable();
|
||||
|
||||
async_hooks.emitInit(expectedId, expectedType, null, expectedResource);
|
||||
|
@ -5,7 +5,7 @@ const async_hooks = require('async_hooks');
|
||||
const fs = require('fs');
|
||||
|
||||
const nestedHook = async_hooks.createHook({
|
||||
init: common.mustNotCall()
|
||||
init: common.mustNotCall(),
|
||||
});
|
||||
let nestedCall = false;
|
||||
|
||||
@ -16,7 +16,7 @@ async_hooks.createHook({
|
||||
nestedCall = true;
|
||||
fs.access(__filename, common.mustCall());
|
||||
}
|
||||
}, 2)
|
||||
}, 2),
|
||||
}).enable();
|
||||
|
||||
fs.access(__filename, common.mustCall());
|
||||
|
@ -17,7 +17,7 @@ const hooks = initHooks();
|
||||
hooks.enable();
|
||||
|
||||
const {
|
||||
HTTP2_HEADER_CONTENT_TYPE
|
||||
HTTP2_HEADER_CONTENT_TYPE,
|
||||
} = http2.constants;
|
||||
|
||||
// Use large fixture to get several file operations.
|
||||
@ -27,7 +27,7 @@ const fd = fs.openSync(fname, 'r');
|
||||
const server = http2.createServer();
|
||||
server.on('stream', (stream) => {
|
||||
stream.respondWithFD(fd, {
|
||||
[HTTP2_HEADER_CONTENT_TYPE]: 'text/plain'
|
||||
[HTTP2_HEADER_CONTENT_TYPE]: 'text/plain',
|
||||
});
|
||||
});
|
||||
server.on('close', common.mustCall(() => fs.closeSync(fd)));
|
||||
|
@ -21,6 +21,6 @@ function onexit() {
|
||||
[ { type: 'FSREQCALLBACK', id: 'fsreq:1', triggerAsyncId: null },
|
||||
{ type: 'FSREQCALLBACK', id: 'fsreq:2', triggerAsyncId: 'fsreq:1' },
|
||||
{ type: 'FSREQCALLBACK', id: 'fsreq:3', triggerAsyncId: 'fsreq:2' },
|
||||
{ type: 'FSREQCALLBACK', id: 'fsreq:4', triggerAsyncId: 'fsreq:3' } ]
|
||||
{ type: 'FSREQCALLBACK', id: 'fsreq:4', triggerAsyncId: 'fsreq:3' } ],
|
||||
);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ server.listen(0, common.mustCall(() => {
|
||||
http.get({
|
||||
host: '::1',
|
||||
family: 6,
|
||||
port: server.address().port
|
||||
port: server.address().port,
|
||||
}, common.mustCall());
|
||||
}));
|
||||
|
||||
@ -48,6 +48,6 @@ process.on('exit', () => {
|
||||
triggerAsyncId: null },
|
||||
{ type: 'SHUTDOWNWRAP',
|
||||
id: 'shutdown:1',
|
||||
triggerAsyncId: 'tcp:2' } ]
|
||||
triggerAsyncId: 'tcp:2' } ],
|
||||
);
|
||||
});
|
||||
|
@ -30,6 +30,6 @@ function onexit() {
|
||||
verifyGraph(
|
||||
hooks,
|
||||
[ { type: 'Timeout', id: 'timeout:1', triggerAsyncId: null },
|
||||
{ type: 'Timeout', id: 'timeout:2', triggerAsyncId: 'timeout:1' }]
|
||||
{ type: 'Timeout', id: 'timeout:2', triggerAsyncId: 'timeout:1' }],
|
||||
);
|
||||
}
|
||||
|
@ -27,6 +27,6 @@ function onexit() {
|
||||
[ { type: 'PROCESSWRAP', id: 'process:1', triggerAsyncId: null },
|
||||
{ type: 'PIPEWRAP', id: 'pipe:1', triggerAsyncId: null },
|
||||
{ type: 'PIPEWRAP', id: 'pipe:2', triggerAsyncId: null },
|
||||
{ type: 'PIPEWRAP', id: 'pipe:3', triggerAsyncId: null } ]
|
||||
{ type: 'PIPEWRAP', id: 'pipe:3', triggerAsyncId: null } ],
|
||||
);
|
||||
}
|
||||
|
@ -34,6 +34,6 @@ function onexit() {
|
||||
{ type: 'PIPECONNECTWRAP', id: 'pipeconnect:1',
|
||||
triggerAsyncId: 'pipe:1' },
|
||||
{ type: 'PIPEWRAP', id: 'pipe:2', triggerAsyncId: 'pipeserver:1' },
|
||||
{ type: 'SHUTDOWNWRAP', id: 'shutdown:1', triggerAsyncId: 'pipe:2' } ]
|
||||
{ type: 'SHUTDOWNWRAP', id: 'shutdown:1', triggerAsyncId: 'pipe:2' } ],
|
||||
);
|
||||
}
|
||||
|
@ -41,6 +41,6 @@ function onexit() {
|
||||
{ type: 'TCPCONNECTWRAP',
|
||||
id: 'tcpconnect:1', triggerAsyncId: 'tcp:1' },
|
||||
{ type: 'TCPWRAP', id: 'tcp:2', triggerAsyncId: 'tcpserver:1' },
|
||||
{ type: 'SHUTDOWNWRAP', id: 'shutdown:1', triggerAsyncId: 'tcp:2' } ]
|
||||
{ type: 'SHUTDOWNWRAP', id: 'shutdown:1', triggerAsyncId: 'tcp:2' } ],
|
||||
);
|
||||
}
|
||||
|
@ -61,6 +61,6 @@ function onexit() {
|
||||
{ type: 'PROCESSWRAP', id: 'process:3', triggerAsyncId: 'signal:1' },
|
||||
{ type: 'PIPEWRAP', id: 'pipe:7', triggerAsyncId: 'signal:1' },
|
||||
{ type: 'PIPEWRAP', id: 'pipe:8', triggerAsyncId: 'signal:1' },
|
||||
{ type: 'PIPEWRAP', id: 'pipe:9', triggerAsyncId: 'signal:1' } ]
|
||||
{ type: 'PIPEWRAP', id: 'pipe:9', triggerAsyncId: 'signal:1' } ],
|
||||
);
|
||||
}
|
||||
|
@ -29,6 +29,6 @@ function onexit() {
|
||||
verifyGraph(
|
||||
hooks,
|
||||
[ { type: 'STATWATCHER', id: 'statwatcher:1', triggerAsyncId: null },
|
||||
{ type: 'STATWATCHER', id: 'statwatcher:2', triggerAsyncId: null } ]
|
||||
{ type: 'STATWATCHER', id: 'statwatcher:2', triggerAsyncId: null } ],
|
||||
);
|
||||
}
|
||||
|
@ -43,6 +43,6 @@ function onexit() {
|
||||
{ type: 'TCPCONNECTWRAP',
|
||||
id: 'tcpconnect:1', triggerAsyncId: 'tcp:1' },
|
||||
{ type: 'TCPWRAP', id: 'tcp:2', triggerAsyncId: 'tcpserver:1' },
|
||||
{ type: 'SHUTDOWNWRAP', id: 'shutdown:1', triggerAsyncId: 'tcp:2' } ]
|
||||
{ type: 'SHUTDOWNWRAP', id: 'shutdown:1', triggerAsyncId: 'tcp:2' } ],
|
||||
);
|
||||
}
|
||||
|
@ -27,6 +27,6 @@ function onexit() {
|
||||
hooks,
|
||||
[ { type: 'Timeout', id: 'timeout:1', triggerAsyncId: null },
|
||||
{ type: 'Timeout', id: 'timeout:2', triggerAsyncId: 'timeout:1' },
|
||||
{ type: 'Timeout', id: 'timeout:3', triggerAsyncId: 'timeout:2' }]
|
||||
{ type: 'Timeout', id: 'timeout:3', triggerAsyncId: 'timeout:2' }],
|
||||
);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ hooks.enable();
|
||||
const server = tls
|
||||
.createServer({
|
||||
cert: fixtures.readKey('rsa_cert.crt'),
|
||||
key: fixtures.readKey('rsa_private.pem')
|
||||
key: fixtures.readKey('rsa_private.pem'),
|
||||
})
|
||||
.on('listening', common.mustCall(onlistening))
|
||||
.on('secureConnection', common.mustCall(onsecureConnection))
|
||||
@ -66,6 +66,6 @@ function onexit() {
|
||||
id: 'tcpconnect:1', triggerAsyncId: 'tcp:1' },
|
||||
{ type: 'TCPWRAP', id: 'tcp:2', triggerAsyncId: 'tcpserver:1' },
|
||||
{ type: 'TLSWRAP', id: 'tls:2', triggerAsyncId: 'tcpserver:1' },
|
||||
]
|
||||
],
|
||||
);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ let responses = 0;
|
||||
const agent = new http.Agent({
|
||||
keepAlive: true,
|
||||
keepAliveMsecs: Infinity,
|
||||
maxSockets: 1
|
||||
maxSockets: 1,
|
||||
});
|
||||
|
||||
const verifyRequest = (idx) => (res) => {
|
||||
@ -58,13 +58,13 @@ const server = http.createServer(common.mustCall((req, res) => {
|
||||
|
||||
// First request.
|
||||
const r1 = http.request({
|
||||
agent, port, method: 'POST'
|
||||
agent, port, method: 'POST',
|
||||
}, common.mustCall(verifyRequest(0)));
|
||||
r1.end(payload);
|
||||
|
||||
// Second request. Sent in parallel with the first one.
|
||||
const r2 = http.request({
|
||||
agent, port, method: 'POST'
|
||||
agent, port, method: 'POST',
|
||||
}, common.mustCall(verifyRequest(1)));
|
||||
r2.end(payload);
|
||||
}));
|
||||
|
@ -20,7 +20,7 @@ let asyncIdAtSecondReq;
|
||||
const agent = new http.Agent({
|
||||
keepAlive: true,
|
||||
keepAliveMsecs: Infinity,
|
||||
maxSockets: 1
|
||||
maxSockets: 1,
|
||||
});
|
||||
|
||||
const server = http.createServer(common.mustCall((req, res) => {
|
||||
@ -38,7 +38,7 @@ const server = http.createServer(common.mustCall((req, res) => {
|
||||
// First request. This is useless except for adding a socket to the
|
||||
// agent’s pool for reuse.
|
||||
const r1 = http.request({
|
||||
agent, port, method: 'POST'
|
||||
agent, port, method: 'POST',
|
||||
}, common.mustCall((res) => {
|
||||
// Remember which socket we used.
|
||||
const socket = res.socket;
|
||||
@ -60,8 +60,8 @@ const server = http.createServer(common.mustCall((req, res) => {
|
||||
// response header has already been received.
|
||||
const r2 = http.request({
|
||||
agent, port, method: 'POST', headers: {
|
||||
'Content-Length': payload.length
|
||||
}
|
||||
'Content-Length': payload.length,
|
||||
},
|
||||
}, common.mustCall((res) => {
|
||||
asyncIdAtSecondReq = res.socket[async_id_symbol];
|
||||
assert.ok(asyncIdAtSecondReq > 0, `${asyncIdAtSecondReq} > 0`);
|
||||
|
@ -29,7 +29,7 @@ createHook({
|
||||
|
||||
if (resource[reused]) {
|
||||
reusedParser.push(
|
||||
`resource reused: ${asyncId}, ${triggerAsyncId}, ${type}`
|
||||
`resource reused: ${asyncId}, ${triggerAsyncId}, ${type}`,
|
||||
);
|
||||
}
|
||||
resource[reused] = true;
|
||||
@ -40,7 +40,7 @@ createHook({
|
||||
} else {
|
||||
destroyed.push(asyncId);
|
||||
}
|
||||
}
|
||||
},
|
||||
}).enable();
|
||||
|
||||
const server = http.createServer((req, res) => {
|
||||
|
@ -16,7 +16,7 @@ const REQUEST = HTTPParser.REQUEST;
|
||||
const kOnHeadersComplete = HTTPParser.kOnHeadersComplete | 0;
|
||||
|
||||
const request = Buffer.from(
|
||||
'GET /hello HTTP/1.1\r\n\r\n'
|
||||
'GET /hello HTTP/1.1\r\n\r\n',
|
||||
);
|
||||
|
||||
const parser = new HTTPParser();
|
||||
|
@ -21,7 +21,7 @@ const request = Buffer.from(
|
||||
'Content-Type: text/plain\r\n' +
|
||||
'Content-Length: 4\r\n' +
|
||||
'\r\n' +
|
||||
'pong'
|
||||
'pong',
|
||||
);
|
||||
|
||||
const parser = new HTTPParser();
|
||||
|
@ -10,7 +10,7 @@ const heartbeatMsg = /heartbeat: still alive/;
|
||||
|
||||
const {
|
||||
newAsyncId, getDefaultTriggerAsyncId,
|
||||
emitInit, emitBefore, emitAfter
|
||||
emitInit, emitBefore, emitAfter,
|
||||
} = internal_async_hooks;
|
||||
|
||||
const initHooks = require('./init-hooks');
|
||||
|
@ -10,7 +10,7 @@ const heartbeatMsg = /heartbeat: still alive/;
|
||||
|
||||
const {
|
||||
newAsyncId, getDefaultTriggerAsyncId,
|
||||
emitInit, emitBefore, emitAfter
|
||||
emitInit, emitBefore, emitAfter,
|
||||
} = internal_async_hooks;
|
||||
|
||||
const initHooks = require('./init-hooks');
|
||||
|
@ -37,7 +37,7 @@ const hook = async_hooks.createHook({
|
||||
destroy: common.mustCall(() => {
|
||||
hook.disable();
|
||||
nextTest();
|
||||
}, 3)
|
||||
}, 3),
|
||||
});
|
||||
|
||||
nextTest();
|
||||
|
@ -23,6 +23,6 @@ process.on('exit', () => {
|
||||
|
||||
const as = hooks.activitiesOfTypes('TickObject');
|
||||
checkInvocations(as[0], {
|
||||
init: 1, before: 1, after: 1, destroy: 1
|
||||
init: 1, before: 1, after: 1, destroy: 1,
|
||||
}, 'when process exits');
|
||||
});
|
||||
|
@ -55,7 +55,7 @@ function onsleepClose() {
|
||||
checkInvocations(
|
||||
processwrap,
|
||||
{ init: 1, before: 1, after: 1 },
|
||||
'processwrap while in onsleepClose callback')
|
||||
'processwrap while in onsleepClose callback'),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,6 @@ process.on('exit', () => {
|
||||
|
||||
const as = hooks.activitiesOfTypes('Microtask');
|
||||
checkInvocations(as[0], {
|
||||
init: 1, before: 1, after: 1, destroy: 1
|
||||
init: 1, before: 1, after: 1, destroy: 1,
|
||||
}, 'when process exits');
|
||||
});
|
||||
|
@ -25,7 +25,7 @@ tls.DEFAULT_MAX_VERSION = 'TLSv1.2';
|
||||
const server = tls
|
||||
.createServer({
|
||||
cert: fixtures.readKey('rsa_cert.crt'),
|
||||
key: fixtures.readKey('rsa_private.pem')
|
||||
key: fixtures.readKey('rsa_private.pem'),
|
||||
})
|
||||
.on('listening', common.mustCall(onlistening))
|
||||
.on('secureConnection', common.mustCall(onsecureConnection))
|
||||
|
@ -35,7 +35,7 @@ const delayedOnCloseHandler = common.mustCall(() => {
|
||||
});
|
||||
process.stdin.on('error', (err) => assert.fail(err));
|
||||
process.stdin.on('close', common.mustCall(() =>
|
||||
tick(2, delayedOnCloseHandler)
|
||||
tick(2, delayedOnCloseHandler),
|
||||
));
|
||||
process.stdin.destroy();
|
||||
checkInvocations(tty, checkInitOpts, 'when tty.end() was invoked');
|
||||
|
@ -15,7 +15,7 @@ const hooks = initHooks({
|
||||
if (type === 'PROMISE') {
|
||||
promiseAsyncIds.push(asyncId);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
hooks.enable();
|
||||
|
@ -29,7 +29,7 @@ const buffers = {
|
||||
writeResult: new Uint32Array(2),
|
||||
dictionary: new Uint8Array(0),
|
||||
inBuf: new Uint8Array([0x78]),
|
||||
outBuf: new Uint8Array(1)
|
||||
outBuf: new Uint8Array(1),
|
||||
};
|
||||
|
||||
handle.init(
|
||||
@ -39,7 +39,7 @@ handle.init(
|
||||
constants.Z_DEFAULT_STRATEGY,
|
||||
buffers.writeResult,
|
||||
function processCallback() { this.cb(); },
|
||||
buffers.dictionary
|
||||
buffers.dictionary,
|
||||
);
|
||||
checkInvocations(hdl, { init: 1 }, 'when initialized handle');
|
||||
|
||||
|
@ -20,7 +20,7 @@ function pruneTickObjects(activities) {
|
||||
const tickObject = {
|
||||
found: true,
|
||||
index: null,
|
||||
data: null
|
||||
data: null,
|
||||
};
|
||||
|
||||
if (!Array.isArray(activities))
|
||||
@ -42,7 +42,7 @@ function pruneTickObjects(activities) {
|
||||
tickObject.data = activities[tickObject.index];
|
||||
const triggerId = {
|
||||
new: tickObject.data.triggerAsyncId,
|
||||
old: tickObject.data.uid
|
||||
old: tickObject.data.uid,
|
||||
};
|
||||
|
||||
activities.forEach(function repointTriggerId(x) {
|
||||
@ -85,7 +85,7 @@ module.exports = function verifyGraph(hooks, graph) {
|
||||
errors.push({
|
||||
id: node.id,
|
||||
expectedTid: node.triggerAsyncId,
|
||||
actualTid: uidtoid[x.triggerAsyncId]
|
||||
actualTid: uidtoid[x.triggerAsyncId],
|
||||
});
|
||||
}
|
||||
|
||||
@ -93,8 +93,8 @@ module.exports = function verifyGraph(hooks, graph) {
|
||||
errors.forEach((x) =>
|
||||
console.error(
|
||||
`'${x.id}' expected to be triggered by '${x.expectedTid}', ` +
|
||||
`but was triggered by '${x.actualTid}' instead.`
|
||||
)
|
||||
`but was triggered by '${x.actualTid}' instead.`,
|
||||
),
|
||||
);
|
||||
}
|
||||
assert.strictEqual(errors.length, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user