11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../common');
31cb0ef41Sopenharmony_ci
41cb0ef41Sopenharmony_cicommon.skipIfInspectorDisabled();
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ciconst fixtures = require('../common/fixtures');
71cb0ef41Sopenharmony_ciconst startCLI = require('../common/debugger');
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ciconst assert = require('assert');
101cb0ef41Sopenharmony_ciconst path = require('path');
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_ci// Using sb before loading file.
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ciconst scriptFullPath = fixtures.path('debugger', 'cjs', 'index.js');
151cb0ef41Sopenharmony_ciconst script = path.relative(process.cwd(), scriptFullPath);
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_ciconst otherScriptFullPath = fixtures.path('debugger', 'cjs', 'other.js');
181cb0ef41Sopenharmony_ciconst otherScript = path.relative(process.cwd(), otherScriptFullPath);
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_ciconst cli = startCLI(['--port=0', script]);
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_ci(async () => {
231cb0ef41Sopenharmony_ci  await cli.waitForInitialBreak();
241cb0ef41Sopenharmony_ci  await cli.waitForPrompt();
251cb0ef41Sopenharmony_ci  await cli.command('sb("other.js", 2)');
261cb0ef41Sopenharmony_ci  assert.match(cli.output, /not loaded yet/,
271cb0ef41Sopenharmony_ci               'warns that the script was not loaded yet');
281cb0ef41Sopenharmony_ci  await cli.stepCommand('cont');
291cb0ef41Sopenharmony_ci  assert.ok(cli.output.includes(`break in ${otherScript}:2`),
301cb0ef41Sopenharmony_ci            'found breakpoint in file that was not loaded yet');
311cb0ef41Sopenharmony_ci})()
321cb0ef41Sopenharmony_ci.then(common.mustCall())
331cb0ef41Sopenharmony_ci.finally(() => cli.quit());
34