@iamsergio/qttest-utils 1.4.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +3 -4
- package/Changelog +31 -0
- package/out/cmake.d.ts +1 -0
- package/out/cmake.js +42 -12
- package/out/qttest.d.ts +2 -1
- package/out/qttest.js +8 -4
- package/out/test.js +5 -0
- package/package.json +1 -1
package/CONTRIBUTING.md
CHANGED
|
@@ -26,10 +26,9 @@ cargo install git-cliff
|
|
|
26
26
|
## Releasing
|
|
27
27
|
|
|
28
28
|
(Replace 1.0.0 with actual version used)
|
|
29
|
-
|
|
30
|
-
export NEW_VERSION=v1.0.0
|
|
29
|
+
- Get a version compatible with semver, run ` git cliff --bump | head -n 5`, replace NEW_VERSION
|
|
30
|
+
- export NEW_VERSION=v1.0.0
|
|
31
31
|
- Make sure Github Actions CI is green
|
|
32
|
-
-
|
|
33
|
-
- Increase version in package.json and package-lock.json.
|
|
32
|
+
- npm version $NEW_VERSION
|
|
34
33
|
- git cliff --tag $NEW_VERSION > Changelog
|
|
35
34
|
- git add Changelog package.json package-lock.json && git commit -m "chore: bump version" && git tag -a ${NEW_VERSION} -m "${NEW_VERSION}" && git push && git push --tags && npm publish
|
package/Changelog
CHANGED
|
@@ -2,6 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
## [2.1.0] - 2024-04-25
|
|
6
|
+
|
|
7
|
+
### 🚀 Features
|
|
8
|
+
|
|
9
|
+
- Add targetNameForExecutable()
|
|
10
|
+
|
|
11
|
+
### 🐛 Bug Fixes
|
|
12
|
+
|
|
13
|
+
- Ignore non-executable targets
|
|
14
|
+
|
|
15
|
+
### ⚙️ Miscellaneous Tasks
|
|
16
|
+
|
|
17
|
+
- Coding style improvement
|
|
18
|
+
- Update CONTRIBUTING.md file
|
|
19
|
+
- Fix build on macOS
|
|
20
|
+
- Improve CONTRIBUTING.md
|
|
21
|
+
|
|
22
|
+
## [2.0.0] - 2024-04-24
|
|
23
|
+
|
|
24
|
+
### 🚀 Features
|
|
25
|
+
|
|
26
|
+
- [**breaking**] Use a member to hold the output function
|
|
27
|
+
|
|
28
|
+
### ⚙️ Miscellaneous Tasks
|
|
29
|
+
|
|
30
|
+
- Bump version
|
|
31
|
+
|
|
5
32
|
## [1.4.0] - 2024-04-24
|
|
6
33
|
|
|
7
34
|
### 🚀 Features
|
|
@@ -12,6 +39,10 @@
|
|
|
12
39
|
|
|
13
40
|
- When running a qttest, output to stdout
|
|
14
41
|
|
|
42
|
+
### ⚙️ Miscellaneous Tasks
|
|
43
|
+
|
|
44
|
+
- Bump version
|
|
45
|
+
|
|
15
46
|
## [1.3.0] - 2024-04-23
|
|
16
47
|
|
|
17
48
|
### 🚀 Features
|
package/out/cmake.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare class CMakeTests {
|
|
|
13
13
|
*/
|
|
14
14
|
tests(): Promise<CMakeTest[] | undefined>;
|
|
15
15
|
private ctestJsonToList;
|
|
16
|
+
targetNameForExecutable(executable: string, codemodel: any): string | undefined;
|
|
16
17
|
cppFilesForExecutable(executable: string, codemodel: any): string[];
|
|
17
18
|
}
|
|
18
19
|
export declare class CMakeTest {
|
package/out/cmake.js
CHANGED
|
@@ -72,6 +72,39 @@ class CMakeTests {
|
|
|
72
72
|
});
|
|
73
73
|
return tests;
|
|
74
74
|
}
|
|
75
|
+
/// Returns the cmake target name for the specified executable
|
|
76
|
+
targetNameForExecutable(executable, codemodel) {
|
|
77
|
+
// simplify:
|
|
78
|
+
if (executable.endsWith(".exe")) {
|
|
79
|
+
executable = executable.substring(0, executable.length - 4);
|
|
80
|
+
}
|
|
81
|
+
let projects = codemodel["projects"];
|
|
82
|
+
if (!projects)
|
|
83
|
+
return undefined;
|
|
84
|
+
for (let project of projects) {
|
|
85
|
+
let targets = project["targets"];
|
|
86
|
+
if (!targets)
|
|
87
|
+
continue;
|
|
88
|
+
for (let target of targets) {
|
|
89
|
+
let artifacts = target["artifacts"];
|
|
90
|
+
if (!artifacts)
|
|
91
|
+
continue;
|
|
92
|
+
for (let artifact of artifacts) {
|
|
93
|
+
if (artifact.endsWith(".exe")) {
|
|
94
|
+
artifact = artifact.substring(0, artifact.length - 4);
|
|
95
|
+
}
|
|
96
|
+
if (artifact == executable) {
|
|
97
|
+
let name = target["name"];
|
|
98
|
+
if (name) {
|
|
99
|
+
// We found the target name
|
|
100
|
+
return name;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
75
108
|
// Returns the list of .cpp files for the specified executable
|
|
76
109
|
// codemodel is the CMake codemodel JSON object
|
|
77
110
|
cppFilesForExecutable(executable, codemodel) {
|
|
@@ -80,37 +113,34 @@ class CMakeTests {
|
|
|
80
113
|
executable = executable.substring(0, executable.length - 4);
|
|
81
114
|
}
|
|
82
115
|
let projects = codemodel["projects"];
|
|
83
|
-
if (!projects)
|
|
116
|
+
if (!projects)
|
|
84
117
|
return [];
|
|
85
|
-
}
|
|
86
118
|
for (let project of projects) {
|
|
87
119
|
let targets = project["targets"];
|
|
88
|
-
if (!targets)
|
|
120
|
+
if (!targets)
|
|
89
121
|
continue;
|
|
90
|
-
}
|
|
91
122
|
for (let target of targets) {
|
|
92
123
|
let sourceDir = target["sourceDirectory"];
|
|
93
124
|
let artifacts = target["artifacts"];
|
|
94
|
-
if (!artifacts || !sourceDir)
|
|
125
|
+
if (!artifacts || !sourceDir)
|
|
126
|
+
continue;
|
|
127
|
+
let targetType = target["type"];
|
|
128
|
+
if (targetType != "EXECUTABLE")
|
|
95
129
|
continue;
|
|
96
|
-
}
|
|
97
130
|
for (let artifact of artifacts) {
|
|
98
131
|
if (artifact.endsWith(".exe")) {
|
|
99
132
|
artifact = artifact.substring(0, artifact.length - 4);
|
|
100
133
|
}
|
|
101
134
|
if (artifact == executable) {
|
|
102
135
|
let fileGroups = target["fileGroups"];
|
|
103
|
-
if (!fileGroups)
|
|
136
|
+
if (!fileGroups)
|
|
104
137
|
continue;
|
|
105
|
-
}
|
|
106
138
|
for (let fileGroup of fileGroups) {
|
|
107
|
-
if (fileGroup["language"] != "CXX" || fileGroup["isGenerated"])
|
|
139
|
+
if (fileGroup["language"] != "CXX" || fileGroup["isGenerated"])
|
|
108
140
|
continue;
|
|
109
|
-
}
|
|
110
141
|
let sources = fileGroup["sources"];
|
|
111
|
-
if (!sources)
|
|
142
|
+
if (!sources)
|
|
112
143
|
continue;
|
|
113
|
-
}
|
|
114
144
|
let cppFiles = [];
|
|
115
145
|
for (let source of sources) {
|
|
116
146
|
if (!source.endsWith("mocs_compilation.cpp")) {
|
package/out/qttest.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare class QtTest {
|
|
|
11
11
|
vscodeTestItem: any | undefined;
|
|
12
12
|
slots: QtTestSlot[] | null;
|
|
13
13
|
lastExitCode: number;
|
|
14
|
+
outputFunc: LoggerFunction | undefined;
|
|
14
15
|
constructor(filename: string, buildDirPath: string);
|
|
15
16
|
get id(): string;
|
|
16
17
|
get label(): string;
|
|
@@ -30,7 +31,7 @@ export declare class QtTest {
|
|
|
30
31
|
linksToQtTestLib(): Promise<boolean> | undefined;
|
|
31
32
|
isQtTestViaHelp(): Promise<boolean | undefined>;
|
|
32
33
|
slotByName(name: string): QtTestSlot | undefined;
|
|
33
|
-
runTest(slot?: QtTestSlot, cwd?: string
|
|
34
|
+
runTest(slot?: QtTestSlot, cwd?: string): Promise<boolean>;
|
|
34
35
|
tapOutputFileName(slot?: QtTestSlot): string;
|
|
35
36
|
txtOutputFileName(slot?: QtTestSlot): string;
|
|
36
37
|
command(): {
|
package/out/qttest.js
CHANGED
|
@@ -62,6 +62,8 @@ class QtTest {
|
|
|
62
62
|
this.slots = null;
|
|
63
63
|
/// Set after running
|
|
64
64
|
this.lastExitCode = 0;
|
|
65
|
+
/// Allows the caller to receive the output of the test process
|
|
66
|
+
this.outputFunc = undefined;
|
|
65
67
|
this.filename = filename;
|
|
66
68
|
this.buildDirPath = buildDirPath;
|
|
67
69
|
}
|
|
@@ -201,7 +203,7 @@ class QtTest {
|
|
|
201
203
|
return undefined;
|
|
202
204
|
}
|
|
203
205
|
/// Runs this test
|
|
204
|
-
runTest(slot, cwd = ""
|
|
206
|
+
runTest(slot, cwd = "") {
|
|
205
207
|
return __awaiter(this, void 0, void 0, function* () {
|
|
206
208
|
let args = [];
|
|
207
209
|
if (slot) {
|
|
@@ -219,13 +221,15 @@ class QtTest {
|
|
|
219
221
|
let cwdDir = cwd.length > 0 ? cwd : this.buildDirPath;
|
|
220
222
|
logMessage("Running " + this.filename + " " + args.join(" ") + " with cwd=" + cwdDir);
|
|
221
223
|
const child = (0, child_process_1.spawn)(this.filename, args, { cwd: cwdDir });
|
|
222
|
-
if (outputFunc) {
|
|
224
|
+
if (this.outputFunc) {
|
|
223
225
|
// Callers wants the process output:
|
|
224
226
|
child.stdout.on("data", (chunk) => {
|
|
225
|
-
|
|
227
|
+
if (this.outputFunc)
|
|
228
|
+
this.outputFunc(chunk.toString());
|
|
226
229
|
});
|
|
227
230
|
child.stderr.on("data", (chunk) => {
|
|
228
|
-
|
|
231
|
+
if (this.outputFunc)
|
|
232
|
+
this.outputFunc(chunk.toString());
|
|
229
233
|
});
|
|
230
234
|
}
|
|
231
235
|
child.on("exit", (code) => __awaiter(this, void 0, void 0, function* () {
|
package/out/test.js
CHANGED
|
@@ -127,6 +127,11 @@ function runCodeModelTests(codeModelFile) {
|
|
|
127
127
|
console.error("Expected " + expected + ", got " + got);
|
|
128
128
|
process.exit(1);
|
|
129
129
|
}
|
|
130
|
+
let targetName = cmake.targetNameForExecutable("/vscode-qttest/test/qt_test/build-dev/test1", codemodelJson);
|
|
131
|
+
if (targetName != "test1") {
|
|
132
|
+
console.error("Expected test1, got " + targetName);
|
|
133
|
+
process.exit(1);
|
|
134
|
+
}
|
|
130
135
|
});
|
|
131
136
|
}
|
|
132
137
|
runTests("test/qt_test/build-dev/");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iamsergio/qttest-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "API for listing QtTest executables from a build directory and which individual test slots each executable contains. Useful for a Text Explorer VSCode extension.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|