summaryrefslogtreecommitdiff
path: root/deps/node-inspect/test/cli/use-strict.test.js
blob: 81f4d91a6a58020a6ada13fc91e1aef03f30df86 (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
'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.waitFor(/break/)
    .then(() => cli.waitForPrompt())
    .then(() => {
      t.match(
        cli.output,
        /break in [^:]+:(?:1|2)[^\d]/,
        'pauses either on strict directive or first "real" line');
    })
    .then(() => cli.quit())
    .then(null, onFatal);
});