summaryrefslogtreecommitdiff
path: root/test/sequential/test-inspector-runtime-evaluate-with-timeout.js
blob: b20aa77a5d5b92353c198e4d02d712d1cacb2dd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
'use strict';

const common = require('../common');
common.skipIfInspectorDisabled();

(async function test() {
  const assert = require('assert');
  const { Session } = require('inspector');
  const { promisify } = require('util');

  const session = new Session();
  session.connect();
  session.post = promisify(session.post);
  await assert.rejects(
    session.post('Runtime.evaluate', {
      expression: 'for(;;);',
      timeout: 0
    }),
    {
      code: 'ERR_INSPECTOR_COMMAND',
      message: 'Inspector error -32000: Execution was terminated'
    }
  );
  session.disconnect();
})();