@iamsergio/qttest-utils 1.2.0 โ 1.3.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 +1 -1
- package/Changelog +25 -0
- package/out/cmake.d.ts +1 -0
- package/out/cmake.js +54 -0
- package/out/test.js +21 -0
- package/package.json +1 -1
package/CONTRIBUTING.md
CHANGED
|
@@ -27,7 +27,7 @@ cargo install git-cliff
|
|
|
27
27
|
|
|
28
28
|
(Replace 1.0.0 with actual version used)
|
|
29
29
|
|
|
30
|
-
export NEW_VERSION=v1.
|
|
30
|
+
export NEW_VERSION=v1.0.0
|
|
31
31
|
- Make sure Github Actions CI is green
|
|
32
32
|
- Optional: To get a version compatible with semver, run `git cliff --bump`
|
|
33
33
|
- Increase version in package.json and package-lock.json.
|
package/Changelog
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
## [1.3.0] - 2024-04-23
|
|
6
|
+
|
|
7
|
+
### ๐ Features
|
|
8
|
+
|
|
9
|
+
- Add cppFilesForExecutable(executable, codemodel)
|
|
10
|
+
|
|
11
|
+
### ๐งช Testing
|
|
12
|
+
|
|
13
|
+
- Add an example cmake code model
|
|
14
|
+
- Normalize paths
|
|
15
|
+
- Simplify some code
|
|
16
|
+
- Fix replacing slashes
|
|
17
|
+
|
|
18
|
+
### โ๏ธ Miscellaneous Tasks
|
|
19
|
+
|
|
20
|
+
- Add more logging
|
|
21
|
+
|
|
5
22
|
## [1.2.0] - 2024-04-22
|
|
6
23
|
|
|
7
24
|
### ๐ Features
|
|
@@ -13,6 +30,14 @@
|
|
|
13
30
|
- Minor CONTRIBUTIND.md improvement
|
|
14
31
|
- Minor CONTRIBUTIND.md improvement
|
|
15
32
|
|
|
33
|
+
### ๐งช Testing
|
|
34
|
+
|
|
35
|
+
- Fix test on windows
|
|
36
|
+
|
|
37
|
+
### โ๏ธ Miscellaneous Tasks
|
|
38
|
+
|
|
39
|
+
- Bump version
|
|
40
|
+
|
|
16
41
|
## [1.1.2] - 2024-04-07
|
|
17
42
|
|
|
18
43
|
### โ๏ธ Miscellaneous Tasks
|
package/out/cmake.d.ts
CHANGED
package/out/cmake.js
CHANGED
|
@@ -72,6 +72,60 @@ class CMakeTests {
|
|
|
72
72
|
});
|
|
73
73
|
return tests;
|
|
74
74
|
}
|
|
75
|
+
// Returns the list of .cpp files for the specified executable
|
|
76
|
+
// codemodel is the CMake codemodel JSON object
|
|
77
|
+
cppFilesForExecutable(executable, codemodel) {
|
|
78
|
+
// simplify:
|
|
79
|
+
if (executable.endsWith(".exe")) {
|
|
80
|
+
executable = executable.substring(0, executable.length - 4);
|
|
81
|
+
}
|
|
82
|
+
let projects = codemodel["projects"];
|
|
83
|
+
if (!projects) {
|
|
84
|
+
return [];
|
|
85
|
+
}
|
|
86
|
+
for (let project of projects) {
|
|
87
|
+
let targets = project["targets"];
|
|
88
|
+
if (!targets) {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
for (let target of targets) {
|
|
92
|
+
let sourceDir = target["sourceDirectory"];
|
|
93
|
+
let artifacts = target["artifacts"];
|
|
94
|
+
if (!artifacts || !sourceDir) {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
for (let artifact of artifacts) {
|
|
98
|
+
if (artifact.endsWith(".exe")) {
|
|
99
|
+
artifact = artifact.substring(0, artifact.length - 4);
|
|
100
|
+
}
|
|
101
|
+
if (artifact == executable) {
|
|
102
|
+
let fileGroups = target["fileGroups"];
|
|
103
|
+
if (!fileGroups) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
for (let fileGroup of fileGroups) {
|
|
107
|
+
if (fileGroup["language"] != "CXX" || fileGroup["isGenerated"]) {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
let sources = fileGroup["sources"];
|
|
111
|
+
if (!sources) {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
let cppFiles = [];
|
|
115
|
+
for (let source of sources) {
|
|
116
|
+
if (!source.endsWith("mocs_compilation.cpp")) {
|
|
117
|
+
cppFiles.push(path_1.default.join(sourceDir, source));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return cppFiles;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
(0, qttest_1.logMessage)("cppFilesForExecutable: Could not find cpp files for executable " + executable);
|
|
127
|
+
return [];
|
|
128
|
+
}
|
|
75
129
|
}
|
|
76
130
|
exports.CMakeTests = CMakeTests;
|
|
77
131
|
/// Represents an inividual CTest test
|
package/out/test.js
CHANGED
|
@@ -12,6 +12,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
12
12
|
});
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const cmake_1 = require("./cmake");
|
|
15
16
|
const qttest_1 = require("./qttest");
|
|
16
17
|
// Be sure to build the Qt tests with CMake first
|
|
17
18
|
// See .github/workflows/ci.yml
|
|
@@ -109,4 +110,24 @@ function runTests(buildDirPath) {
|
|
|
109
110
|
}
|
|
110
111
|
});
|
|
111
112
|
}
|
|
113
|
+
function runCodeModelTests(codeModelFile) {
|
|
114
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
const fs = require('fs');
|
|
116
|
+
let codemodelStr = fs.readFileSync(codeModelFile, 'utf8');
|
|
117
|
+
let codemodelJson = JSON.parse(codemodelStr);
|
|
118
|
+
let cmake = new cmake_1.CMakeTests("random");
|
|
119
|
+
let files = cmake.cppFilesForExecutable("/vscode-qttest/test/qt_test/build-dev/test1", codemodelJson);
|
|
120
|
+
if (files.length != 1) {
|
|
121
|
+
console.error("Expected 1 file, got " + files.length);
|
|
122
|
+
process.exit(1);
|
|
123
|
+
}
|
|
124
|
+
let expected = "/vscode-qttest/test/qt_test/test1.cpp";
|
|
125
|
+
let got = files[0].replace(/\\/g, "/");
|
|
126
|
+
if (got != expected) {
|
|
127
|
+
console.error("Expected " + expected + ", got " + got);
|
|
128
|
+
process.exit(1);
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
112
132
|
runTests("test/qt_test/build-dev/");
|
|
133
|
+
runCodeModelTests("test/test_cmake_codemodel.json");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iamsergio/qttest-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.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",
|