summaryrefslogtreecommitdiff
path: root/deps/node-inspect/test/cli/use-strict.test.js
blob: c6dc8f31cd82b549bb3f6229dcc871f2e3be04b9 (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
'use strict';
const Path = require('path');

const { test } = require('tap');

const startCLI = require('./start-cli');

test('for whiles that starts with strict directive', (t) => {
  const script = Path.join('examples', 'use-strict.js');
  const cli = startCLI([script]);

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

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