mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-02 22:41:31 +01:00
JSON parse launch.json to determine whether program configuration was correctly added.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { SpectronApplication } from '../spectron/application';
|
||||
var stripJsonComments = require('strip-json-comments');
|
||||
|
||||
export class JavaScriptDebug {
|
||||
private readonly sidebarSelector = '.margin-view-overlays';
|
||||
@@ -17,14 +18,20 @@ export class JavaScriptDebug {
|
||||
}
|
||||
|
||||
public async pressConfigureLaunchJson(): Promise<any> {
|
||||
await this.spectron.waitFor(this.spectron.client.click, 'ul[aria-label="Debug actions"] .action-label.icon.debug-action.configure');
|
||||
try {
|
||||
await this.spectron.waitFor(this.spectron.client.click, 'ul[aria-label="Debug actions"] .action-label.icon.debug-action.configure');
|
||||
} catch (e) {
|
||||
return Promise.reject('Clicking on debug configuration gear failed.');
|
||||
}
|
||||
await this.spectron.wait();
|
||||
await this.spectron.client.keys(['ArrowDown', 'NULL', 'Enter']);
|
||||
return this.spectron.wait();
|
||||
}
|
||||
|
||||
public getProgramConfigValue(): Promise<any> {
|
||||
return this.spectron.client.getText('.view-lines>:nth-child(11) .mtk7');
|
||||
public async getProgramConfigValue(): Promise<any> {
|
||||
const lines = stripJsonComments(await this.spectron.client.getText('.view-lines'));
|
||||
const json = JSON.parse(lines);
|
||||
return json.configurations[0].program;
|
||||
}
|
||||
|
||||
public setBreakpointOnLine(lineNumber: number): Promise<any> {
|
||||
|
||||
@@ -31,7 +31,7 @@ export function testJavaScriptDebug() {
|
||||
await jsDebug.openDebugViewlet();
|
||||
await jsDebug.pressConfigureLaunchJson();
|
||||
const value = await jsDebug.getProgramConfigValue();
|
||||
process.platform === 'win32' ? assert.equal(value, '"${workspaceRoot}\\\\bin\\\\www"') : assert.equal(value, '"${workspaceRoot}/bin/www"');
|
||||
process.platform === 'win32' ? assert.equal(value, '${workspaceRoot}\\bin\\www') : assert.equal(value, '${workspaceRoot}/bin/www');
|
||||
});
|
||||
|
||||
it(`can set a breakpoint and verify if it's set`, async function () {
|
||||
|
||||
Reference in New Issue
Block a user