summaryrefslogtreecommitdiff
path: root/test/parallel/test-http-timeout-client-warning.js
blob: f11515b95fe3404c2c0f539abe64609a2684d019 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
'use strict';
const common = require('../common');
const http = require('http');
const assert = require('assert');

// Checks that the setTimeout duration overflow warning is emitted
// synchronously and therefore contains a meaningful stacktrace.

process.on('warning', common.mustCall((warning) => {
  assert(warning.stack.includes(__filename));
}));

const server = http.createServer((req, resp) => resp.end());
server.listen(common.mustCall(() => {
  http.request(`http://localhost:${server.address().port}`)
    .setTimeout(2 ** 40)
    .on('response', common.mustCall(() => {
      server.close();
    }))
    .end();
}));