@iamsergio/qttest-utils 2.2.2 → 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.
@@ -1,5 +1,75 @@
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
+
57
+ ## [2.3.0](https://github.com/KDAB/qttest-utils/compare/v2.2.2...v2.3.0) (2024-06-06)
58
+
59
+
60
+ ### Features
61
+
62
+ * Add support for QEXPECT_FAIL ([0037921](https://github.com/KDAB/qttest-utils/commit/003792112bd6093640e772dcfd109812f38324bd))
63
+ * Add support for XPASS ([a60be6b](https://github.com/KDAB/qttest-utils/commit/a60be6b81f22d3a18ee624e2414e91c37e2c607f))
64
+
65
+
66
+ ### Bug Fixes
67
+
68
+ * Fix JSON output from ctest not being received ([9cea2c3](https://github.com/KDAB/qttest-utils/commit/9cea2c3dd4b5798f7f6f0bf382e5eca1694f0eb2))
69
+ * Use tap-parser instead of regexp to parse tap files ([3d9f1f5](https://github.com/KDAB/qttest-utils/commit/3d9f1f5abc77d2af1a57ba6a75b89c8a3ad424ed))
70
+
71
+ # Changelog
72
+
3
73
 
4
74
 
5
75
  ## [2.2.2] - 2024-05-02
@@ -226,4 +296,3 @@
226
296
 
227
297
  - Ran formatting
228
298
  - Pass the entire slot
229
-
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,32 +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("exit", (code) => {
53
- if (code === 0) {
54
- resolve(this.ctestJsonToList(output));
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"));
55
50
  }
56
51
  else {
57
- reject(new Error("Failed to run ctest"));
52
+ resolve(this.ctestJsonToList(output));
58
53
  }
59
- });
60
- return undefined;
54
+ }
55
+ else {
56
+ reject(new Error("Failed to run ctest"));
57
+ }
61
58
  });
59
+ return undefined;
62
60
  });
63
61
  }
64
62
  ctestJsonToList(json) {
@@ -202,10 +200,8 @@ class CMakeTests {
202
200
  exports.CMakeTests = CMakeTests;
203
201
  /// Represents an inividual CTest test
204
202
  class CMakeTest {
205
- constructor() {
206
- this.command = [];
207
- this.cwd = "";
208
- }
203
+ command = [];
204
+ cwd = "";
209
205
  id() {
210
206
  return this.command.join(",");
211
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();