Skip to content

Commit

Permalink
adopt test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
weinand committed Jan 25, 2016
1 parent 9a07f04 commit e18e442
Show file tree
Hide file tree
Showing 11 changed files with 729 additions and 77 deletions.
19 changes: 11 additions & 8 deletions .vscode/launch.json
Expand Up @@ -10,38 +10,41 @@
"--extensionDevelopmentPath=${workspaceRoot}"
],
"sourceMaps": true,
"outDir": "./out"
"outDir": "${workspaceRoot}/out"
},
{
"name": "mock-debug server",
"type": "node",
"request": "launch",
"runtimeArgs": ["--harmony"],
"program": "./src/mockDebug.ts",
"program": "${workspaceRoot}/src/mockDebug.ts",
"stopOnEntry": false,
"args": [ "--server=4711" ],
"sourceMaps": true,
"outDir": "./out"
"outDir": "${workspaceRoot}/out",
"cwd": "${workspaceRoot}"
},
{
"name": "mock test",
"type": "mock",
"request": "launch",
"program": "README.md",
"program": "${workspaceRoot}/README.md",
"stopOnEntry": true
},
{
"name": "Run Tests",
"type": "node",
"request": "launch",
"program": "node_modules/mocha/bin/_mocha",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"args": [
"./out/tests",
"-u", "tdd",
"--timeout", "999999",
"--colors"
"--colors",
"./out/tests/"
],
"sourceMaps": true,
"outDir": "./out"
"outDir": "${workspaceRoot}/out",
"cwd": "${workspaceRoot}"
}
]
}
5 changes: 2 additions & 3 deletions .vscode/settings.json
@@ -1,8 +1,7 @@
// Place your settings in this file to overwrite default and user settings.
// Place your settings in this file to overwrite default and user settings.FALSE
{
"javascript.validate.enable": false,
"files.trimTrailingWhitespace": true,
"eslint.enable": false,
"editor.insertSpaces": false,
"editor.tabSize": 4
"editor.insertSpaces": false
}
8 changes: 4 additions & 4 deletions package.json
Expand Up @@ -23,18 +23,18 @@
"url": "https://github.com/Microsoft/vscode-mock-debug/issues"
},
"dependencies": {
"vscode-debugadapter": "^1.0.1",
"vscode-debugprotocol": "^1.0.1"
"vscode-debugadapter": "^1.4.1",
"vscode-debugprotocol": "^1.4.0"
},
"devDependencies": {
"typescript": "^1.6.2",
"mocha": "*"
"mocha": "^2.3.4"
},
"scripts": {
"prepublish": "tsc -p ./src",
"compile": "tsc -p ./src",
"watch": "tsc -w -p ./src",
"test": "mocha out/tests"
"test": "node ./node_modules/mocha/bin/mocha -u tdd ./out/tests/"
},
"contributes": {
"debuggers": [
Expand Down
9 changes: 6 additions & 3 deletions src/mockDebug.ts
Expand Up @@ -2,6 +2,8 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/

"use strict";

import {DebugSession, InitializedEvent, TerminatedEvent, StoppedEvent, OutputEvent, Thread, StackFrame, Scope, Source, Handles} from 'vscode-debugadapter';
import {DebugProtocol} from 'vscode-debugprotocol';
import {readFileSync} from 'fs';
Expand Down Expand Up @@ -48,10 +50,11 @@ class MockDebugSession extends DebugSession {
}

protected initializeRequest(response: DebugProtocol.InitializeResponse, args: DebugProtocol.InitializeRequestArguments): void {
this.sendResponse(response);

// now we are ready to accept breakpoints -> fire the initialized event to give UI a chance to set breakpoints
// announce that we are ready to accept breakpoints -> fire the initialized event to give UI a chance to set breakpoints
this.sendEvent(new InitializedEvent());

super.initializeRequest(response, args);
}

protected launchRequest(response: DebugProtocol.LaunchResponse, args: LaunchRequestArguments): void {
Expand Down Expand Up @@ -188,7 +191,7 @@ class MockDebugSession extends DebugSession {
if (lines && lines.indexOf(ln) >= 0) {
this._currentLine = ln;
this.sendResponse(response);
this.sendEvent(new StoppedEvent("step", MockDebugSession.THREAD_ID));
this.sendEvent(new StoppedEvent("breakpoint", MockDebugSession.THREAD_ID));
return;
}
// if word 'exception' found in source -> throw exception
Expand Down

0 comments on commit e18e442

Please sign in to comment.