|
| 1 | +'use strict'; |
| 2 | + |
| 3 | +const common = require('../common'); |
| 4 | +common.skipIfInspectorDisabled(); |
| 5 | +if (!process.config.variables.node_use_amaro) skip('Requires Amaro'); |
| 6 | + |
| 7 | +const { NodeInstance } = require('../common/inspector-helper.js'); |
| 8 | +const fixtures = require('../common/fixtures'); |
| 9 | +const assert = require('assert'); |
| 10 | + |
| 11 | +const scriptPath = fixtures.path('typescript/ts/test-typescript.ts'); |
| 12 | + |
| 13 | +async function runTest() { |
| 14 | + const child = new NodeInstance( |
| 15 | + ['--inspect-brk=0', '--experimental-strip-types'], |
| 16 | + undefined, |
| 17 | + scriptPath); |
| 18 | + |
| 19 | + const session = await child.connectInspectorSession(); |
| 20 | + |
| 21 | + const commands = [ |
| 22 | + { 'method': 'Debugger.enable' }, |
| 23 | + { 'method': 'Runtime.enable' }, |
| 24 | + { 'method': 'Runtime.runIfWaitingForDebugger' }, |
| 25 | + ]; |
| 26 | + |
| 27 | + await session.send(commands); |
| 28 | + |
| 29 | + const scriptParsed = await session.waitForNotification((notification) => { |
| 30 | + if (notification.method !== 'Debugger.scriptParsed') return false; |
| 31 | + |
| 32 | + return notification.params.url === scriptPath; |
| 33 | + }); |
| 34 | + // Verify that the script has a sourceURL, hinting that it is a generated source. |
| 35 | + assert(scriptParsed.params.hasSourceURL); |
| 36 | + |
| 37 | + session.disconnect(); |
| 38 | + assert.strictEqual((await child.expectShutdown()).exitCode, 0); |
| 39 | +} |
| 40 | + |
| 41 | +runTest().then(common.mustCall()); |
0 commit comments