forked from withfig/autocomplete
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpunit-watcher.ts
41 lines (39 loc) · 1.02 KB
/
phpunit-watcher.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
const tests: Fig.Generator = {
script: "phpunit --list-tests",
postProcess: function (out) {
if (out.startsWith("fatal:")) {
return [];
}
return out
.split("\n")
.filter((line) => line.indexOf("::") > 0)
.map((line) => {
return {
name: line.substring(line.indexOf("::") + 2, line.length),
icon: "fig://icon?type=php",
description: line.substring(line.indexOf("::") + 2, line.length),
};
});
},
};
export const completionSpec: Fig.Spec = {
name: "phpunit-watcher",
description: "Automatically rerun PHPUnit tests when source code changes",
subcommands: [
{
name: "watch",
description:
"This will run the tests and rerun them whenever a file in the app, src or tests directory is modified.",
options: [
{
name: ["--filter"],
description: "watch a specific test",
args: {
generators: tests,
name: "filter",
},
},
],
},
],
};