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 { spawn } = require('child_process');
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_ciconst script = fixtures.path('debugger', 'alive.js');
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ciconst runTest = async () => {
151cb0ef41Sopenharmony_ci  const target = spawn(process.execPath, [script]);
161cb0ef41Sopenharmony_ci  const cli = startCLI(['-p', `${target.pid}`]);
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_ci  try {
191cb0ef41Sopenharmony_ci    await cli.waitForPrompt();
201cb0ef41Sopenharmony_ci    await cli.command('sb("alive.js", 3)');
211cb0ef41Sopenharmony_ci    await cli.waitFor(/break/);
221cb0ef41Sopenharmony_ci    await cli.waitForPrompt();
231cb0ef41Sopenharmony_ci    assert.match(
241cb0ef41Sopenharmony_ci      cli.output,
251cb0ef41Sopenharmony_ci      /> 3 {3}\+\+x;/,
261cb0ef41Sopenharmony_ci      'marks the 3rd line');
271cb0ef41Sopenharmony_ci  } catch (error) {
281cb0ef41Sopenharmony_ci    assert.ifError(error);
291cb0ef41Sopenharmony_ci  } finally {
301cb0ef41Sopenharmony_ci    await cli.quit();
311cb0ef41Sopenharmony_ci    target.kill();
321cb0ef41Sopenharmony_ci  }
331cb0ef41Sopenharmony_ci};
341cb0ef41Sopenharmony_ci
351cb0ef41Sopenharmony_cirunTest().then(common.mustCall());
36