Constructor

new(runtime:String, executable:String, debugType:String, ?spawnOptions:ChildProcessSpawnOptions, ?enableStderr:Bool)

Creates a DebugClient object that provides a promise-based API to write debug adapter tests. A simple mocha example for setting and hitting a breakpoint in line 15 of a program 'test.js' looks like this:

var dc; setup( () => {

dc = new DebugClient('node', './out/node/nodeDebug.js', 'node');
return dc.start();

}); teardown( () => dc.stop() );

test('should stop on a breakpoint', () => {

return dc.hitBreakpoint({ program: 'test.js' }, 'test.js', 15);

});

Variables

Methods

assertOutput<T>(category:String, expected:String, ?timeout:Int):Promise<Event<T>>

Returns a promise that will resolve if enough output events with the given category have been received and the concatenated data match the expected data. The promise will be rejected as soon as the received data cannot match the expected data or if a timeout occurs.

assertPath(path:String, expected:EitherType<String, RegExp>, ?message:String):Void

assertStoppedLocation(reason:String, expected:{path:Null<EitherType<String, RegExp>>, line:Null<Int>, column:Null<Int>}):Promise<StackTraceResponse>

Returns a promise that will resolve if a 'stopped' event was received within some specified time and the event's reason and line number was asserted. The promise will be rejected if a timeout occurs, the assertions fail, or if the 'stackTrace' request fails.

configurationSequence():Promise<Dynamic>

Returns a promise that will resolve if an 'initialized' event was received within some specified time and a subsequent 'configurationDone' request was successfully executed. The promise will be rejected if a timeout occurs or if the 'configurationDone' request fails.

customRequest<T>(command:String, ?args:Dynamic):Response<T>

hitBreakpoint(launchArgs:Dynamic, location:ILocation, ?expectedStopLocation:IPartialLocation, ?expectedBPLocation:IPartialLocation):Promise<Dynamic>

Returns a promise that will resolve if a configurable breakpoint has been hit within some time and the event's reason and line number was asserted. The promise will be rejected if a timeout occurs, the assertions fail, or if the requests fails.

launch(launchArgs:Dynamic):Promise<LaunchResponse>

Returns a promise that will resolve if a 'initialize' and a 'launch' request were successful.

start(?port:Int):Promise<Dynamic>

Starts a new debug adapter and sets up communication via stdin/stdout. If a port number is specified the adapter is not launched but a connection to a debug adapter running in server mode is established. This is useful for debugging the adapter while running tests. For this reason all timeouts are disabled in server mode.

stop():Promise<Dynamic>

Shutdown the debuggee and the debug adapter (or disconnect if in server mode).

waitForEvent<T>(eventType:String, ?timeout:Int):Promise<Event<T>>

Returns a promise that will resolve if an event with a specific type was received within some specified time. The promise will be rejected if a timeout occurs.