2017-03-15 11:05:23 -07:00
|
|
|
'use strict';
|
2021-04-08 23:55:45 -07:00
|
|
|
const common = require('../common');
|
2017-03-15 11:05:23 -07:00
|
|
|
|
2021-04-08 23:55:45 -07:00
|
|
|
common.skipIfInspectorDisabled();
|
2017-03-15 11:05:23 -07:00
|
|
|
|
2021-04-08 23:55:45 -07:00
|
|
|
const fixtures = require('../common/fixtures');
|
2021-05-03 21:58:42 -07:00
|
|
|
const startCLI = require('../common/debugger');
|
2017-03-15 11:05:23 -07:00
|
|
|
|
2021-04-08 23:55:45 -07:00
|
|
|
const assert = require('assert');
|
|
|
|
|
|
|
|
// Test for files that start with strict directive.
|
|
|
|
{
|
2021-06-25 22:11:59 -07:00
|
|
|
const script = fixtures.path('debugger', 'use-strict.js');
|
2023-03-28 00:03:40 +02:00
|
|
|
const cli = startCLI(['--port=0', script]);
|
2017-03-15 11:05:23 -07:00
|
|
|
|
|
|
|
function onFatal(error) {
|
|
|
|
cli.quit();
|
|
|
|
throw error;
|
|
|
|
}
|
|
|
|
|
2017-04-04 09:47:43 -07:00
|
|
|
return cli.waitForInitialBreak()
|
2017-03-15 11:05:23 -07:00
|
|
|
.then(() => cli.waitForPrompt())
|
|
|
|
.then(() => {
|
2019-06-03 10:05:10 +02:00
|
|
|
const brk = cli.breakInfo;
|
2021-04-08 23:55:45 -07:00
|
|
|
assert.match(
|
2019-06-03 10:05:10 +02:00
|
|
|
`${brk.line}`,
|
|
|
|
/^(1|2)$/,
|
2017-03-15 11:05:23 -07:00
|
|
|
'pauses either on strict directive or first "real" line');
|
|
|
|
})
|
|
|
|
.then(() => cli.quit())
|
|
|
|
.then(null, onFatal);
|
2021-04-08 23:55:45 -07:00
|
|
|
}
|