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