1'use strict'; 2const common = require('../common'); 3 4common.skipIfInspectorDisabled(); 5 6const fixtures = require('../common/fixtures'); 7const startCLI = require('../common/debugger'); 8const assert = require('assert'); 9 10// Debugger agent direct access. 11{ 12 const cli = startCLI(['--port=0', fixtures.path('debugger/three-lines.js')]); 13 const scriptPattern = /^\* (\d+): \S+debugger(?:\/|\\)three-lines\.js/m; 14 15 async function testDebuggerLowLevel() { 16 try { 17 await cli.waitForInitialBreak(); 18 await cli.waitForPrompt(); 19 await cli.command('scripts'); 20 const [, scriptId] = cli.output.match(scriptPattern); 21 await cli.command( 22 `Debugger.getScriptSource({ scriptId: '${scriptId}' })` 23 ); 24 assert.match( 25 cli.output, 26 /scriptSource:[ \n]*'(?:\(function \(|let x = 1)/); 27 assert.match( 28 cli.output, 29 /let x = 1;/); 30 } finally { 31 await cli.quit(); 32 } 33 } 34 testDebuggerLowLevel(); 35} 36