• Home
  • Raw
  • Download

Lines Matching +full:require +full:- +full:common +full:- +full:first

2 // Flags: --expose-internals
3 const common = require('../common'); constant
4 const initHooks = require('./init-hooks');
5 const { checkInvocations } = require('./hook-checks');
6 const assert = require('assert');
7 const { async_id_symbol } = require('internal/async_hooks').symbols;
8 const http = require('http');
11 // is not reused. Test is based on parallel\test-async-hooks-http-agent.js.
26 const server = http.createServer(common.mustCall((req, res) => {
27 req.once('data', common.mustCallAtLeast(() => {
28 res.writeHead(200, { 'Content-Type': 'text/plain' });
31 req.on('end', common.mustCall(() => {
34 }, 2)).listen(0, common.mustCall(() => {
38 // First request. This is useless except for adding a socket to the
42 }, common.mustCall((res) => {
50 res.on('data', common.mustCallAtLeast());
51 res.on('end', common.mustCall(() => {
53 setImmediate(common.mustCall(() => {
55 assert.strictEqual(socket[async_id_symbol], -1);
57 // Second request. To re-create the exact conditions from the
59 // (hence the Content-Length header) and call .end() after the
63 'Content-Length': payload.length,
65 }, common.mustCall((res) => {
73 res.on('data', common.mustCallAtLeast());
74 res.on('end', common.mustCall(() => {
99 const first = activities.filter((x) => x.uid === asyncIdAtFirstReq)[0];
100 checkInvocations(first, { init: 1, destroy: 1 }, 'when process exits');
106 assert.strictEqual(first.type, second.type);
107 assert.ok(first.handle !== second.handle, 'Resource reused');
108 assert.ok(first.handle === second.handle.handle,