1'use strict'; 2const Path = require('path'); 3 4const { test } = require('tap'); 5 6const startCLI = require('./start-cli'); 7 8test('for whiles that starts with strict directive', (t) => { 9 const script = Path.join('examples', 'use-strict.js'); 10 const cli = startCLI([script]); 11 12 function onFatal(error) { 13 cli.quit(); 14 throw error; 15 } 16 17 return cli.waitForInitialBreak() 18 .then(() => cli.waitForPrompt()) 19 .then(() => { 20 const brk = cli.breakInfo; 21 t.match( 22 `${brk.line}`, 23 /^(1|2)$/, 24 'pauses either on strict directive or first "real" line'); 25 }) 26 .then(() => cli.quit()) 27 .then(null, onFatal); 28}); 29