-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathextension.ts
73 lines (63 loc) · 1.9 KB
/
extension.ts
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
"use strict";
import * as vscode from "vscode";
import { TestRunner } from "./phpunittest";
export function activate(context: vscode.ExtensionContext) {
let taskCommand: string = null;
let problemMatcher: string = null;
const outputChannel = vscode.window.createOutputChannel("phpunit");
const PHPUnitTestRunner: TestRunner = new TestRunner(outputChannel, {
setTaskCommand: (command: string, matcher?: string) => {
taskCommand = command;
problemMatcher = matcher;
}
});
context.subscriptions.push(
vscode.commands.registerCommand("phpunit.Test", () => {
PHPUnitTestRunner.run("test");
})
);
context.subscriptions.push(
vscode.commands.registerCommand("phpunit.TestNearest", () => {
PHPUnitTestRunner.run("nearest-test");
})
);
context.subscriptions.push(
vscode.commands.registerCommand("phpunit.TestSuite", () => {
PHPUnitTestRunner.run("suite");
})
);
context.subscriptions.push(
vscode.commands.registerCommand("phpunit.TestDirectory", () => {
PHPUnitTestRunner.run("directory");
})
);
context.subscriptions.push(
vscode.commands.registerCommand("phpunit.RerunLastTest", () => {
PHPUnitTestRunner.run("rerun-last-test");
})
);
context.subscriptions.push(
vscode.commands.registerCommand("phpunit.TestingStop", () => {
PHPUnitTestRunner.stop();
})
);
context.subscriptions.push(
vscode.tasks.registerTaskProvider("phpunit", {
provideTasks: () => {
return [
new vscode.Task(
{ type: "phpunit", task: "run" },
vscode.TaskScope.Workspace,
"run",
"phpunit",
new vscode.ShellExecution(taskCommand),
problemMatcher || "$phpunit"
)
];
},
resolveTask: undefined
})
);
}
// this method is called when your extension is deactivated
export function deactivate() {}