This repository was archived by the owner on Oct 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 236
/
Copy pathcommands.test.ts
102 lines (90 loc) · 3.45 KB
/
commands.test.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//
// Note: This example test is leveraging the Mocha test framework.
// Please refer to their documentation on https://mochajs.org/ for help.
//
import * as vscode from "vscode";
// Defines a Mocha test suite to group tests of similar kind together
suite("Arduino: Commands Tests", () => {
// tslint:disable-next-line: only-arrow-functions
setup(function(done) {
// Ensure that extension is activate while testing
this.timeout(60 * 1000);
const extension = vscode.extensions.getExtension("vsciot-vscode.vscode-arduino");
if (!extension.isActive) {
extension.activate().then((api) => {
// The extension waits 100ms before registering some commands,
// so add a longer delay here before running tests.
setTimeout(() => done(), 200);
}, () => {
done("Failed to activate extension");
});
} else {
done();
}
});
// Arduino: Initialize:Scaffold a VS Code project with an Arduino sketch.
// tslint:disable-next-line: only-arrow-functions
test("should be able to run command: arduino.initialize", function(done) {
this.timeout(60 * 1000);
try {
// run "Arduino: Boards Manager" command.
vscode.commands.executeCommand("arduino.initialize").then((result) => {
done();
});
} catch (error) {
done(new Error(error));
}
});
// Arduino: Boards Manager : Manage packages for boards
// tslint:disable-next-line: only-arrow-functions
test("should be able to run command: arduino.showBoardManager", function(done) {
this.timeout(60 * 1000);
try {
// run "Arduino: Boards Manager" command.
vscode.commands.executeCommand("arduino.showBoardManager").then((result) => {
done();
});
} catch (error) {
done(new Error(error));
}
});
// Arduino: Libraries Manager: Explore and manage libraries
// tslint:disable-next-line: only-arrow-functions
test("should be able to run command: arduino.showLibraryManager", function(done) {
this.timeout(10 * 1000);
try {
// run "Arduino: Libraries Manager" command.
vscode.commands.executeCommand("arduino.showLibraryManager").then((result) => {
done();
});
} catch (error) {
done(new Error(error));
}
});
// Arduino: Arduino Board Configuration
// tslint:disable-next-line: only-arrow-functions
test("should be able to run command: arduino.showBoardConfig", function(done) {
this.timeout(10 * 1000);
try {
// run "Arduino: Arduino Board Configuration" command.
vscode.commands.executeCommand("arduino.showBoardConfig").then((result) => {
done();
});
} catch (error) {
done(new Error(error));
}
});
// Arduino: Examples: Show example list
// tslint:disable-next-line: only-arrow-functions
test("should be able to run command: arduino.showExamples", function(done) {
this.timeout(10 * 1000);
try {
// run "Arduino: Examples" command.
vscode.commands.executeCommand("arduino.showExamples").then((result) => {
done();
});
} catch (error) {
done(new Error(error));
}
});
});