• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3
4common.skipIfInspectorDisabled();
5
6if (!common.hasCrypto)
7  common.skip('missing crypto');
8
9const assert = require('assert');
10const https = require('https');
11const { spawnSync } = require('child_process');
12const child = spawnSync(process.execPath, ['--inspect', '-e', '""']);
13const stderr = child.stderr.toString();
14const helpUrl = stderr.match(/For help, see: (.+)/)[1];
15
16function check(url, cb) {
17  https.get(url, common.mustCall((res) => {
18    assert(res.statusCode >= 200 && res.statusCode < 400);
19
20    if (res.statusCode >= 300)
21      return check(res.headers.location, cb);
22
23    let result = '';
24
25    res.setEncoding('utf8');
26    res.on('data', (data) => {
27      result += data;
28    });
29
30    res.on('end', common.mustCall(() => {
31      assert(/>Debugging Guide</.test(result));
32      cb();
33    }));
34  })).on('error', common.mustNotCall);
35}
36
37check(helpUrl, common.mustCall());
38