summaryrefslogtreecommitdiff
path: root/test/parallel/test-debugger-use-strict.js
blob: dce928697659ea3d0c9b50180bb76f2f954a69fe (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
26
27
28
29
30
31
32
'use strict';
const common = require('../common');

common.skipIfInspectorDisabled();

const fixtures = require('../common/fixtures');
const startCLI = require('../common/debugger');

const assert = require('assert');

// Test for files that start with strict directive.
{
  const script = fixtures.path('debugger', 'use-strict.js');
  const cli = startCLI(['--port=0', script]);

  function onFatal(error) {
    cli.quit();
    throw error;
  }

  return cli.waitForInitialBreak()
    .then(() => cli.waitForPrompt())
    .then(() => {
      const brk = cli.breakInfo;
      assert.match(
        `${brk.line}`,
        /^(1|2)$/,
        'pauses either on strict directive or first "real" line');
    })
    .then(() => cli.quit())
    .then(null, onFatal);
}