forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-inspector-strip-types.js
More file actions
46 lines (35 loc) · 1.58 KB
/
Copy pathtest-inspector-strip-types.js
File metadata and controls
46 lines (35 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
'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 { pathToFileURL } = require('url');
const scriptPath = fixtures.path('typescript/ts/test-typescript.ts');
const scriptURL = pathToFileURL(scriptPath);
async function runTest() {
const child = new NodeInstance(
['--inspect-brk=0', '--experimental-strip-types'],
undefined,
scriptPath);
const session = await child.connectInspectorSession();
await session.send({ method: 'NodeRuntime.enable' });
await session.waitForNotification('NodeRuntime.waitingForDebugger');
await session.send([
{ 'method': 'Debugger.enable' },
{ 'method': 'Runtime.enable' },
{ 'method': 'Runtime.runIfWaitingForDebugger' },
]);
await session.send({ method: 'NodeRuntime.disable' });
const scriptParsed = await session.waitForNotification((notification) => {
if (notification.method !== 'Debugger.scriptParsed') return false;
return notification.params.url === scriptPath || notification.params.url === scriptURL.href;
});
// Verify that the script has a sourceURL, hinting that it is a generated source.
assert(scriptParsed.params.hasSourceURL || common.isInsideDirWithUnusualChars);
await session.waitForPauseOnStart();
await session.runToCompletion();
assert.strictEqual((await child.expectShutdown()).exitCode, 0);
}
runTest().then(common.mustCall());