@iamsergio/qttest-utils 2.3.0 β†’ 2.5.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/CHANGELOG.md CHANGED
@@ -1,5 +1,59 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.5.0](https://github.com/KDAB/qttest-utils/compare/v2.4.4...v2.5.0) (2026-04-04)
4
+
5
+
6
+ ### Features
7
+
8
+ * move to node22 ([9918007](https://github.com/KDAB/qttest-utils/commit/9918007bb7765d0363452afdab06856d8505cf18))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * Remove the npm publish stuff from CI ([84069f5](https://github.com/KDAB/qttest-utils/commit/84069f594073c1ea54fe58915aa1beb70353d7e0))
14
+
15
+ ## [2.4.4](https://github.com/KDAB/qttest-utils/compare/v2.4.3...v2.4.4) (2026-04-04)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * Add verbose flag to publish ([1db610e](https://github.com/KDAB/qttest-utils/commit/1db610e9a372c88435460140e6e31769649bfcd0))
21
+
22
+ ## [2.4.3](https://github.com/KDAB/qttest-utils/compare/v2.4.2...v2.4.3) (2026-04-04)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * normalize repository url for npm provenance ([4c74b4b](https://github.com/KDAB/qttest-utils/commit/4c74b4b47bb170840be6a1b3ae6e7d70ed333b97))
28
+
29
+ ## [2.4.2](https://github.com/KDAB/qttest-utils/compare/v2.4.1...v2.4.2) (2026-04-04)
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * Testing release process ([01e5b2e](https://github.com/KDAB/qttest-utils/commit/01e5b2e608289f9dc86ff553459276e4fc83a801))
35
+
36
+ ## [2.4.1](https://github.com/KDAB/qttest-utils/compare/v2.4.0...v2.4.1) (2026-04-04)
37
+
38
+
39
+ ### Bug Fixes
40
+
41
+ * Remove cliff and update to new release-please action ([7480c13](https://github.com/KDAB/qttest-utils/commit/7480c132962de8274a7ccfaf84b19a8a5f192bfa))
42
+ * Remove unneeded cruft from package ([b33c153](https://github.com/KDAB/qttest-utils/commit/b33c1538da9177ea11c1fd546075e149e32a6738))
43
+
44
+ ## [2.4.0](https://github.com/KDAB/qttest-utils/compare/v2.3.0...v2.4.0) (2026-04-03)
45
+
46
+
47
+ ### Features
48
+
49
+ * bump TypeScript target to ES2022 and add engines field ([9d44860](https://github.com/KDAB/qttest-utils/commit/9d44860dc40b48373b3eaed22abf577e191a84c1))
50
+ * rename cmake presets, make Qt6 the default ([#6](https://github.com/KDAB/qttest-utils/issues/6)) ([f60b6e7](https://github.com/KDAB/qttest-utils/commit/f60b6e72fdc1d6b3e86fb840c80aa8498c5bac94))
51
+
52
+
53
+ ### Bug Fixes
54
+
55
+ * add rootDir to tsconfig to fix TS5011 with ES2022 target ([d921982](https://github.com/KDAB/qttest-utils/commit/d921982bbbda550f22aa764b6e138bd5fe761771))
56
+
3
57
  ## [2.3.0](https://github.com/KDAB/qttest-utils/compare/v2.2.2...v2.3.0) (2024-06-06)
4
58
 
5
59
 
@@ -13,3 +67,232 @@
13
67
 
14
68
  * Fix JSON output from ctest not being received ([9cea2c3](https://github.com/KDAB/qttest-utils/commit/9cea2c3dd4b5798f7f6f0bf382e5eca1694f0eb2))
15
69
  * Use tap-parser instead of regexp to parse tap files ([3d9f1f5](https://github.com/KDAB/qttest-utils/commit/3d9f1f5abc77d2af1a57ba6a75b89c8a3ad424ed))
70
+
71
+ # Changelog
72
+
73
+
74
+
75
+ ## [2.2.2] - 2024-05-02
76
+
77
+ ### πŸ› Bug Fixes
78
+
79
+ - Filter out weird tests
80
+
81
+ ### βš™οΈ Miscellaneous Tasks
82
+
83
+ - Code format cmake.ts
84
+
85
+ ## [2.2.1] - 2024-05-02
86
+
87
+ ### πŸ› Bug Fixes
88
+
89
+ - Fix running non-Qt tests
90
+ - Harden code against exception when reading .tap file
91
+
92
+ ### πŸ§ͺ Testing
93
+
94
+ - Try fixing tests on macOS/Windows
95
+ - Try harder to fix macOS/Windows tests
96
+
97
+ ### βš™οΈ Miscellaneous Tasks
98
+
99
+ - Ran code format on tests
100
+ - Run codeformat on qttest.ts
101
+ - Bump version
102
+
103
+ ## [2.2.0] - 2024-04-25
104
+
105
+ ### πŸš€ Features
106
+
107
+ - Allow to workaround microsoft/vscode-cmake-tools-api/issues/7
108
+
109
+ ### βš™οΈ Miscellaneous Tasks
110
+
111
+ - Bump version
112
+
113
+ ## [2.1.1] - 2024-04-25
114
+
115
+ ### πŸ› Bug Fixes
116
+
117
+ - Allow for backslashes in the cmake codemodel
118
+
119
+ ### βš™οΈ Miscellaneous Tasks
120
+
121
+ - Improve CONTRIBUTING.md
122
+ - Bump version
123
+
124
+ ## [2.1.0] - 2024-04-25
125
+
126
+ ### πŸš€ Features
127
+
128
+ - Add targetNameForExecutable()
129
+
130
+ ### πŸ› Bug Fixes
131
+
132
+ - Ignore non-executable targets
133
+
134
+ ### βš™οΈ Miscellaneous Tasks
135
+
136
+ - Coding style improvement
137
+ - Update CONTRIBUTING.md file
138
+ - Fix build on macOS
139
+ - Improve CONTRIBUTING.md
140
+ - Bump version
141
+
142
+ ## [2.0.0] - 2024-04-24
143
+
144
+ ### πŸš€ Features
145
+
146
+ - [**breaking**] Use a member to hold the output function
147
+
148
+ ### βš™οΈ Miscellaneous Tasks
149
+
150
+ - Bump version
151
+
152
+ ## [1.4.0] - 2024-04-24
153
+
154
+ ### πŸš€ Features
155
+
156
+ - Allow the caller to pass a output callback
157
+
158
+ ### πŸ› Bug Fixes
159
+
160
+ - When running a qttest, output to stdout
161
+
162
+ ### βš™οΈ Miscellaneous Tasks
163
+
164
+ - Bump version
165
+
166
+ ## [1.3.0] - 2024-04-23
167
+
168
+ ### πŸš€ Features
169
+
170
+ - Add cppFilesForExecutable(executable, codemodel)
171
+
172
+ ### πŸ§ͺ Testing
173
+
174
+ - Add an example cmake code model
175
+ - Normalize paths
176
+ - Simplify some code
177
+ - Fix replacing slashes
178
+
179
+ ### βš™οΈ Miscellaneous Tasks
180
+
181
+ - Add more logging
182
+ - Bump version
183
+
184
+ ## [1.2.0] - 2024-04-22
185
+
186
+ ### πŸš€ Features
187
+
188
+ - Added executablesContainingSlot(name) public method
189
+
190
+ ### πŸ“š Documentation
191
+
192
+ - Minor CONTRIBUTIND.md improvement
193
+ - Minor CONTRIBUTIND.md improvement
194
+
195
+ ### πŸ§ͺ Testing
196
+
197
+ - Fix test on windows
198
+
199
+ ### βš™οΈ Miscellaneous Tasks
200
+
201
+ - Bump version
202
+
203
+ ## [1.1.2] - 2024-04-07
204
+
205
+ ### βš™οΈ Miscellaneous Tasks
206
+
207
+ - Add more logging
208
+ - Bump version
209
+
210
+ ## [1.1.1] - 2024-04-07
211
+
212
+ ### πŸ› Bug Fixes
213
+
214
+ - Verbose logging not appearing in vscode
215
+
216
+ ### βš™οΈ Miscellaneous Tasks
217
+
218
+ - Improve CONTRIBUTING.md
219
+ - Bump version
220
+
221
+ ## [1.1.0] - 2024-04-07
222
+
223
+ ### πŸš€ Features
224
+
225
+ - Added QtTest.verbose property
226
+
227
+ ### πŸ§ͺ Testing
228
+
229
+ - Add a QBENCHMARK
230
+ - Fix tests on windows
231
+ - Fix more cases of wrong slashes
232
+ - Test linksToQtTestLib too
233
+
234
+ ### βš™οΈ Miscellaneous Tasks
235
+
236
+ - Minor readme comment
237
+ - Update .npmignore
238
+ - Fix typo in README
239
+ - Fix badge urls in README
240
+ - Mention the vscode extension in the README
241
+ - Remove duplicate vscode workspace file
242
+ - Add macOS and Windows to CI
243
+ - Make npm install be verose
244
+ - Trying fixing the path for tsc on macos
245
+ - Update packages
246
+ - Bump version
247
+
248
+ ## [1.0.0] - 2024-04-04
249
+
250
+ ### πŸ§ͺ Testing
251
+
252
+ - Add a proper test and add it to cI
253
+
254
+ ### βš™οΈ Miscellaneous Tasks
255
+
256
+ - Add a git-cliff configuration file
257
+ - Add pre-commit support
258
+ - README improvements
259
+ - Add installation instructions to README
260
+ - Add a Dockerfile with nodejs 18
261
+ - *(ci)* Make pre-commit run on master branch
262
+ - Update version in package-lock.json
263
+ - *(docker)* Install npm, Qt5 and typescript
264
+ - *(ci)* Run tsc in ci
265
+ - *(ci)* Fix typo in yml file
266
+ - *(ci)* Bump to checkout v4
267
+ - *(ci)* Bump to setup-node v4
268
+ - *(ci)* Rename main ci job to 'build'
269
+ - *(vscode)* Add a workspace file
270
+ - Formatted some code automatically
271
+ - Fix typo in comment
272
+ - *(ci)* Install Qt and ninja
273
+ - Bump to version 1.0.0
274
+ - Regenerate out/
275
+ - Add a CONTRIBUTING.md file
276
+ - Update changelog
277
+ - Add ci badges to readme
278
+
279
+ ## [0.4.9] - 2023-04-06
280
+
281
+ ### πŸ§ͺ Testing
282
+
283
+ - Make test3 abort at the beginning
284
+
285
+ ## [0.4.7] - 2023-04-02
286
+
287
+ ### πŸ§ͺ Testing
288
+
289
+ - Rename the test slots
290
+
291
+ ### README
292
+
293
+ - Explain how to run the example
294
+
295
+ ### Minor
296
+
297
+ - Ran formatting
298
+ - Pass the entire slot
package/out/cmake.js CHANGED
@@ -2,15 +2,6 @@
2
2
  // SPDX-FileCopyrightText: 2023 KlarΓ€lvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
3
3
  // Author: Sergio Martins <sergio.martins@kdab.com>
4
4
  // SPDX-License-Identifier: MIT
5
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
6
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7
- return new (P || (P = Promise))(function (resolve, reject) {
8
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
9
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
10
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11
- step((generator = generator.apply(thisArg, _arguments || [])).next());
12
- });
13
- };
14
5
  var __importDefault = (this && this.__importDefault) || function (mod) {
15
6
  return (mod && mod.__esModule) ? mod : { "default": mod };
16
7
  };
@@ -25,6 +16,8 @@ const qttest_1 = require("./qttest");
25
16
  * Contains methods to discover Qt Tests via CMake
26
17
  */
27
18
  class CMakeTests {
19
+ // The build dir where we'll run
20
+ buildDirPath;
28
21
  constructor(buildDirPath) {
29
22
  this.buildDirPath = buildDirPath;
30
23
  }
@@ -33,39 +26,37 @@ class CMakeTests {
33
26
  *
34
27
  * @returns a promise with the list of tests
35
28
  */
36
- tests() {
37
- return __awaiter(this, void 0, void 0, function* () {
38
- // TODO: Check if folder exists
39
- if (this.buildDirPath.length == 0) {
40
- console.error("Could not find out cmake build dir");
41
- return undefined;
42
- }
43
- return new Promise((resolve, reject) => {
44
- (0, qttest_1.logMessage)("Running ctest --show-only=json-v1 with cwd=" + this.buildDirPath);
45
- const child = (0, child_process_1.spawn)("ctest", ["--show-only=json-v1"], {
46
- cwd: this.buildDirPath,
47
- });
48
- let output = "";
49
- child.stdout.on("data", (chunk) => {
50
- output += chunk.toString();
51
- });
52
- child.on("close", (code) => {
53
- if (code === 0) {
54
- if (output.length == 0) {
55
- console.error("ctestJsonToList: Empty json output. Command was ctest --show-only=json-v1 , in " +
56
- this.buildDirPath);
57
- reject(new Error("Failed to get ctest JSON output"));
58
- }
59
- else {
60
- resolve(this.ctestJsonToList(output));
61
- }
29
+ async tests() {
30
+ // TODO: Check if folder exists
31
+ if (this.buildDirPath.length == 0) {
32
+ console.error("Could not find out cmake build dir");
33
+ return undefined;
34
+ }
35
+ return new Promise((resolve, reject) => {
36
+ (0, qttest_1.logMessage)("Running ctest --show-only=json-v1 with cwd=" + this.buildDirPath);
37
+ const child = (0, child_process_1.spawn)("ctest", ["--show-only=json-v1"], {
38
+ cwd: this.buildDirPath,
39
+ });
40
+ let output = "";
41
+ child.stdout.on("data", (chunk) => {
42
+ output += chunk.toString();
43
+ });
44
+ child.on("close", (code) => {
45
+ if (code === 0) {
46
+ if (output.length == 0) {
47
+ console.error("ctestJsonToList: Empty json output. Command was ctest --show-only=json-v1 , in " +
48
+ this.buildDirPath);
49
+ reject(new Error("Failed to get ctest JSON output"));
62
50
  }
63
51
  else {
64
- reject(new Error("Failed to run ctest"));
52
+ resolve(this.ctestJsonToList(output));
65
53
  }
66
- });
67
- return undefined;
54
+ }
55
+ else {
56
+ reject(new Error("Failed to run ctest"));
57
+ }
68
58
  });
59
+ return undefined;
69
60
  });
70
61
  }
71
62
  ctestJsonToList(json) {
@@ -209,10 +200,8 @@ class CMakeTests {
209
200
  exports.CMakeTests = CMakeTests;
210
201
  /// Represents an inividual CTest test
211
202
  class CMakeTest {
212
- constructor() {
213
- this.command = [];
214
- this.cwd = "";
215
- }
203
+ command = [];
204
+ cwd = "";
216
205
  id() {
217
206
  return this.command.join(",");
218
207
  }
package/out/example.js CHANGED
@@ -2,77 +2,66 @@
2
2
  // SPDX-FileCopyrightText: 2023 KlarΓ€lvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
3
3
  // Author: Sergio Martins <sergio.martins@kdab.com>
4
4
  // SPDX-License-Identifier: MIT
5
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
6
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7
- return new (P || (P = Promise))(function (resolve, reject) {
8
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
9
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
10
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11
- step((generator = generator.apply(thisArg, _arguments || [])).next());
12
- });
13
- };
14
5
  var __importDefault = (this && this.__importDefault) || function (mod) {
15
6
  return (mod && mod.__esModule) ? mod : { "default": mod };
16
7
  };
17
8
  Object.defineProperty(exports, "__esModule", { value: true });
18
9
  const qttest_1 = require("./qttest");
19
10
  const fs_1 = __importDefault(require("fs"));
20
- function example() {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- const args = process.argv.slice(2);
23
- if (args.length != 1) {
24
- console.error("ERROR: Expected a single argument with the build-dir with cmake tests!");
25
- process.exit(2);
26
- }
27
- let buildDirPath = args[0];
28
- if (!fs_1.default.existsSync(buildDirPath)) {
29
- console.error('Directory does not exist!');
30
- process.exit(1);
31
- }
32
- let qt = new qttest_1.QtTests();
33
- qt.setLogFunction((message) => {
34
- console.log(message);
35
- });
36
- // Gather all tests that would be executed by CTest:
37
- yield qt.discoverViaCMake(buildDirPath);
38
- // Filter-out the ones that don't link to QtTest (doctests and such)
39
- yield qt.removeNonLinking();
40
- // Example of filtering out by regexp:
41
- qt.removeMatching(/(tst_view|tst_window)/);
42
- // Uncomment to see example of filtering out by regexp (inverted):
43
- // qt.maintainMatching(/(tst_docks|tst_qtwidgets|tst_multisplitter)/);
44
- qt.dumpExecutablePaths();
45
- yield qt.dumpTestSlots();
46
- console.log("\nRunning tests...");
47
- for (var executable of qt.qtTestExecutables) {
48
- yield executable.runTest();
49
- if (executable.lastExitCode === 0)
50
- console.log(" PASS: " + executable.filename);
51
- else
52
- console.log(" FAIL: " + executable.filename + "; code=" + executable.lastExitCode);
53
- for (let slot of executable.slots) {
54
- if (slot.lastTestFailure) {
55
- console.log(" failed slot=" + slot.name + "; path=" + slot.lastTestFailure.filePath + "; line=" + slot.lastTestFailure.lineNumber);
56
- }
57
- else {
58
- console.log(" pass: " + slot.name);
59
- }
11
+ async function example() {
12
+ const args = process.argv.slice(2);
13
+ if (args.length != 1) {
14
+ console.error("ERROR: Expected a single argument with the build-dir with cmake tests!");
15
+ process.exit(2);
16
+ }
17
+ let buildDirPath = args[0];
18
+ if (!fs_1.default.existsSync(buildDirPath)) {
19
+ console.error('Directory does not exist!');
20
+ process.exit(1);
21
+ }
22
+ let qt = new qttest_1.QtTests();
23
+ qt.setLogFunction((message) => {
24
+ console.log(message);
25
+ });
26
+ // Gather all tests that would be executed by CTest:
27
+ await qt.discoverViaCMake(buildDirPath);
28
+ // Filter-out the ones that don't link to QtTest (doctests and such)
29
+ await qt.removeNonLinking();
30
+ // Example of filtering out by regexp:
31
+ qt.removeMatching(/(tst_view|tst_window)/);
32
+ // Uncomment to see example of filtering out by regexp (inverted):
33
+ // qt.maintainMatching(/(tst_docks|tst_qtwidgets|tst_multisplitter)/);
34
+ qt.dumpExecutablePaths();
35
+ await qt.dumpTestSlots();
36
+ console.log("\nRunning tests...");
37
+ for (var executable of qt.qtTestExecutables) {
38
+ await executable.runTest();
39
+ if (executable.lastExitCode === 0)
40
+ console.log(" PASS: " + executable.filename);
41
+ else
42
+ console.log(" FAIL: " + executable.filename + "; code=" + executable.lastExitCode);
43
+ for (let slot of executable.slots) {
44
+ if (slot.lastTestFailure) {
45
+ console.log(" failed slot=" + slot.name + "; path=" + slot.lastTestFailure.filePath + "; line=" + slot.lastTestFailure.lineNumber);
46
+ }
47
+ else {
48
+ console.log(" pass: " + slot.name);
60
49
  }
61
50
  }
62
- // Also run individual slots, just for example purposes:
63
- console.log("\nRunning single tests...");
64
- let slot = qt.qtTestExecutables[1].slots[0];
65
- yield slot.runTest();
66
- if (slot.lastTestFailure)
67
- console.log(" FAIL:" + JSON.stringify(slot.lastTestFailure));
68
- else
69
- console.log(" PASS:");
70
- let slot2 = qt.qtTestExecutables[1].slots[2];
71
- yield slot2.runTest();
72
- if (slot2.lastTestFailure)
73
- console.log(" FAIL:" + JSON.stringify(slot2.lastTestFailure));
74
- else
75
- console.log(" PASS");
76
- });
51
+ }
52
+ // Also run individual slots, just for example purposes:
53
+ console.log("\nRunning single tests...");
54
+ let slot = qt.qtTestExecutables[1].slots[0];
55
+ await slot.runTest();
56
+ if (slot.lastTestFailure)
57
+ console.log(" FAIL:" + JSON.stringify(slot.lastTestFailure));
58
+ else
59
+ console.log(" PASS:");
60
+ let slot2 = qt.qtTestExecutables[1].slots[2];
61
+ await slot2.runTest();
62
+ if (slot2.lastTestFailure)
63
+ console.log(" FAIL:" + JSON.stringify(slot2.lastTestFailure));
64
+ else
65
+ console.log(" PASS");
77
66
  }
78
67
  example();