-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
module: add sourceURL magic comment hinting generated source
Source map is not necessary in strip-only mode. However, to map the source file in debuggers to the original TypeScript source, add a sourceURL magic comment to hint that it is a generated source. PR-URL: #54402 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Kohei Ueno <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
- Loading branch information
1 parent
68e94c1
commit 5376e69
Showing
3 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
common.skipIfInspectorDisabled(); | ||
if (!process.config.variables.node_use_amaro) common.skip('Requires Amaro'); | ||
|
||
const { NodeInstance } = require('../common/inspector-helper.js'); | ||
const fixtures = require('../common/fixtures'); | ||
const assert = require('assert'); | ||
|
||
const scriptPath = fixtures.path('typescript/ts/test-typescript.ts'); | ||
|
||
async function runTest() { | ||
const child = new NodeInstance( | ||
['--inspect-brk=0', '--experimental-strip-types'], | ||
undefined, | ||
scriptPath); | ||
|
||
const session = await child.connectInspectorSession(); | ||
|
||
const commands = [ | ||
{ 'method': 'Debugger.enable' }, | ||
{ 'method': 'Runtime.enable' }, | ||
{ 'method': 'Runtime.runIfWaitingForDebugger' }, | ||
]; | ||
|
||
await session.send(commands); | ||
|
||
const scriptParsed = await session.waitForNotification((notification) => { | ||
if (notification.method !== 'Debugger.scriptParsed') return false; | ||
|
||
return notification.params.url === scriptPath; | ||
}); | ||
// Verify that the script has a sourceURL, hinting that it is a generated source. | ||
assert(scriptParsed.params.hasSourceURL); | ||
|
||
await session.waitForPauseOnStart(); | ||
await session.runToCompletion(); | ||
|
||
assert.strictEqual((await child.expectShutdown()).exitCode, 0); | ||
} | ||
|
||
runTest().then(common.mustCall()); |