Column BP tests
This commit is contained in:
Родитель
22a9d6c1d7
Коммит
c77829dad4
|
@ -30,7 +30,7 @@
|
|||
"-u", "tdd",
|
||||
"--colors",
|
||||
"out/test/**/*.test.js",
|
||||
"--reporter", "out/test/int/loggingReporter.js",
|
||||
"--reporter", "node_modules/vscode-chrome-debug-core-testsupport/out/loggingReporter.js",
|
||||
"--timeout", "1800000"
|
||||
],
|
||||
"outFiles": ["${workspaceRoot}/out/**/*.js"]
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
"@types/node": "^6.0.41",
|
||||
"@types/source-map": "^0.1.27",
|
||||
"@types/tmp": "0.0.32",
|
||||
"chrome-remote-debug-protocol": "^1.2.20161007",
|
||||
"concurrently": "^3.1.0",
|
||||
"glob": "^7.1.1",
|
||||
"gulp": "^3.9.1",
|
||||
|
@ -43,8 +42,8 @@
|
|||
"typemoq": "^0.3.3",
|
||||
"typescript": "^2.2.1",
|
||||
"vscode": "^1.0.3",
|
||||
"vscode-chrome-debug-core-testsupport": "^3.14.4",
|
||||
"vscode-debugadapter-testsupport": "^1.15.0",
|
||||
"vscode-chrome-debug-core-testsupport": "^3.14.5",
|
||||
"vscode-debugadapter-testsupport": "^1.18.1",
|
||||
"vscode-debugprotocol": "^1.18.0-pre.2",
|
||||
"webpack": "^2.2.0-rc.1",
|
||||
"webpack-fail-plugin": "^1.0.5"
|
||||
|
|
|
@ -7,7 +7,7 @@ import * as path from 'path';
|
|||
|
||||
import {ChromeDebugAdapter as CoreDebugAdapter, logger, utils as coreUtils, ISourceMapPathOverrides, stoppedEvent} from 'vscode-chrome-debug-core';
|
||||
import {spawn, ChildProcess, fork, execSync} from 'child_process';
|
||||
import Crdp from 'chrome-remote-debug-protocol';
|
||||
import {Crdp} from 'vscode-chrome-debug-core';
|
||||
import {DebugProtocol} from 'vscode-debugprotocol';
|
||||
|
||||
import {ILaunchRequestArgs, IAttachRequestArgs, ICommonRequestArgs} from './chromeDebugInterfaces';
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import {EventEmitter} from 'events';
|
||||
import {Mock, It} from 'typemoq';
|
||||
import Crdp from 'chrome-remote-debug-protocol';
|
||||
import {Crdp} from 'vscode-chrome-debug-core';
|
||||
|
||||
export interface IMockChromeConnectionAPI {
|
||||
apiObjects: Crdp.CrdpClient;
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import * as path from 'path';
|
||||
const {createServer} = require('http-server');
|
||||
|
||||
import {DebugClient} from 'vscode-debugadapter-testsupport';
|
||||
import * as ts from 'vscode-chrome-debug-core-testsupport';
|
||||
|
||||
import * as testSetup from './testSetup';
|
||||
|
||||
suite('Breakpoints', () => {
|
||||
const DATA_ROOT = testSetup.DATA_ROOT;
|
||||
|
||||
let dc: ts.ExtendedDebugClient;
|
||||
setup(() => {
|
||||
return testSetup.setup()
|
||||
.then(_dc => dc = _dc);
|
||||
});
|
||||
|
||||
let server: any;
|
||||
teardown(() => {
|
||||
if (server) {
|
||||
server.close();
|
||||
}
|
||||
|
||||
return testSetup.teardown();
|
||||
});
|
||||
|
||||
suite.only('Column BPs', () => {
|
||||
test('Column BP is hit on correct column', async () => {
|
||||
const testProjectRoot = path.join(DATA_ROOT, 'columns');
|
||||
const scriptPath = path.join(testProjectRoot, 'src/script.ts');
|
||||
|
||||
server = createServer({ root: testProjectRoot });
|
||||
server.listen(7890);
|
||||
|
||||
const url = 'http://localhost:7890/index.html';
|
||||
|
||||
const bpLine = 4;
|
||||
const bpCol = 16;
|
||||
await dc.hitBreakpointUnverified({ url, webRoot: testProjectRoot }, { path: scriptPath, line: bpLine, column: bpCol });
|
||||
});
|
||||
|
||||
test('Multiple column BPs are hit on correct columns', async () => {
|
||||
const testProjectRoot = path.join(DATA_ROOT, 'columns');
|
||||
const scriptPath = path.join(testProjectRoot, 'src/script.ts');
|
||||
|
||||
server = createServer({ root: testProjectRoot });
|
||||
server.listen(7890);
|
||||
|
||||
const url = 'http://localhost:7890/index.html';
|
||||
|
||||
const bpLine = 4;
|
||||
const bpCol1 = 16;
|
||||
const bpCol2 = 24;
|
||||
await dc.hitBreakpointUnverified({ url, webRoot: testProjectRoot }, { path: scriptPath, line: bpLine, column: bpCol1 });
|
||||
await dc.setBreakpointsRequest({ source: { path: scriptPath }, breakpoints: [{ line: bpLine, column: bpCol2 }] });
|
||||
await dc.continueTo('breakpoint', { line: bpLine, column: bpCol2 });
|
||||
});
|
||||
|
||||
test('BP col is adjusted to correct col', async () => {
|
||||
const testProjectRoot = path.join(DATA_ROOT, 'columns');
|
||||
const scriptPath = path.join(testProjectRoot, 'src/script.ts');
|
||||
|
||||
server = createServer({ root: testProjectRoot });
|
||||
server.listen(7890);
|
||||
|
||||
const url = 'http://localhost:7890/index.html';
|
||||
|
||||
const bpLine = 4;
|
||||
const bpCol1 = 19;
|
||||
const correctBpCol1 = 16;
|
||||
const expectedLocation = { path: scriptPath, line: bpLine, column: correctBpCol1 };
|
||||
await dc.hitBreakpoint(
|
||||
{ url, webRoot: testProjectRoot },
|
||||
{ path: scriptPath, line: bpLine, column: bpCol1 },
|
||||
expectedLocation,
|
||||
expectedLocation);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -7,17 +7,16 @@
|
|||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"url": "http://localhost:8080/index.html",
|
||||
// "file": "${workspaceRoot}/wwwroot/index.html",
|
||||
// "diagnosticLogging": true,
|
||||
"port": 9223,
|
||||
"webRoot": "${workspaceRoot}/wwwroot",
|
||||
"showAsyncStacks": true,
|
||||
"disableNetworkCache": true,
|
||||
"trace": true
|
||||
"disableNetworkCache": true
|
||||
},
|
||||
{
|
||||
"debugServer": 4712,
|
||||
"name": "attach to chrome",
|
||||
"type": "chrome",
|
||||
"port": 9223,
|
||||
"port": 9222,
|
||||
"request": "attach",
|
||||
"webRoot": "${workspaceRoot}/wwwroot"
|
||||
}
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
"taskName": "watch",
|
||||
"args": [],
|
||||
"isBuildCommand": true,
|
||||
"isWatching": true,
|
||||
"isBackground": true,
|
||||
"showOutput": "never",
|
||||
"problemMatcher": [
|
||||
"$tsc"
|
||||
]
|
||||
|
|
|
@ -45,7 +45,7 @@ newlines`;
|
|||
var str = 'hello';
|
||||
var xyz = 1;
|
||||
var obj = { a: 2, get thing() { throw 'xyz'; }, set thing(x) { } };
|
||||
xyz++; xyz++;
|
||||
xyz++; xyz++; xyz++;
|
||||
|
||||
anotherFn(fn);
|
||||
fn();
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="out/script.js"></script>
|
||||
<body>
|
||||
<h1>testdata/columns</h1>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,9 @@
|
|||
setInterval(function () {
|
||||
var x = 1;
|
||||
for (var i = 0; i < 5; i++) {
|
||||
x++;
|
||||
x++;
|
||||
x++;
|
||||
}
|
||||
}, 0);
|
||||
//# sourceMappingURL=script.js.map
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"script.js","sourceRoot":"","sources":["../src/script.ts"],"names":[],"mappings":"AAAA,WAAW,CAAC;IACR,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACzB,CAAC,EAAE,CAAC;QAAG,CAAC,EAAE,CAAC;QAAI,CAAC,EAAE,CAAC;IACvB,CAAC;AACL,CAAC,EAAE,CAAC,CAAC,CAAC"}
|
|
@ -0,0 +1,6 @@
|
|||
setInterval(() => {
|
||||
let x = 1;
|
||||
for (let i = 0; i < 5; i++) {
|
||||
x++; x++; x++;
|
||||
}
|
||||
}, 0);
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "out",
|
||||
"sourceMap": true
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче