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_ci
111cb0ef41Sopenharmony_ci// List scripts.
121cb0ef41Sopenharmony_ci{
131cb0ef41Sopenharmony_ci  const script = fixtures.path('debugger', 'three-lines.js');
141cb0ef41Sopenharmony_ci  const cli = startCLI(['--port=0', script]);
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ci  (async () => {
171cb0ef41Sopenharmony_ci    try {
181cb0ef41Sopenharmony_ci      await cli.waitForInitialBreak();
191cb0ef41Sopenharmony_ci      await cli.waitForPrompt();
201cb0ef41Sopenharmony_ci      await cli.command('scripts');
211cb0ef41Sopenharmony_ci      assert.match(
221cb0ef41Sopenharmony_ci        cli.output,
231cb0ef41Sopenharmony_ci        /^\* \d+: \S+debugger(?:\/|\\)three-lines\.js/m,
241cb0ef41Sopenharmony_ci        'lists the user script');
251cb0ef41Sopenharmony_ci      assert.doesNotMatch(
261cb0ef41Sopenharmony_ci        cli.output,
271cb0ef41Sopenharmony_ci        /\d+: node:internal\/buffer/,
281cb0ef41Sopenharmony_ci        'omits node-internal scripts');
291cb0ef41Sopenharmony_ci      await cli.command('scripts(true)');
301cb0ef41Sopenharmony_ci      assert.match(
311cb0ef41Sopenharmony_ci        cli.output,
321cb0ef41Sopenharmony_ci        /\* \d+: \S+debugger(?:\/|\\)three-lines\.js/,
331cb0ef41Sopenharmony_ci        'lists the user script');
341cb0ef41Sopenharmony_ci      assert.match(
351cb0ef41Sopenharmony_ci        cli.output,
361cb0ef41Sopenharmony_ci        /\d+: node:internal\/buffer/,
371cb0ef41Sopenharmony_ci        'includes node-internal scripts');
381cb0ef41Sopenharmony_ci    } finally {
391cb0ef41Sopenharmony_ci      await cli.quit();
401cb0ef41Sopenharmony_ci    }
411cb0ef41Sopenharmony_ci  })().then(common.mustCall());
421cb0ef41Sopenharmony_ci}
43