@iamsergio/qttest-utils 1.1.2 → 1.2.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 CHANGED
@@ -27,12 +27,9 @@ cargo install git-cliff
27
27
 
28
28
  (Replace 1.0.0 with actual version used)
29
29
 
30
- export NEW_VERSION=v1.0.0
30
+ export NEW_VERSION=v1.2.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.
34
34
  - git cliff --tag $NEW_VERSION > Changelog
35
- - git add Changelog package.json package-lock.json && git commit -m "chore: bump version"
36
- - git tag -a ${NEW_VERSION} -m "${NEW_VERSION}"
37
- - git push && git push --tags
38
- - npm publish
35
+ - 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,11 +2,23 @@
2
2
 
3
3
 
4
4
 
5
+ ## [1.2.0] - 2024-04-22
6
+
7
+ ### 🚀 Features
8
+
9
+ - Added executablesContainingSlot(name) public method
10
+
11
+ ### 📚 Documentation
12
+
13
+ - Minor CONTRIBUTIND.md improvement
14
+ - Minor CONTRIBUTIND.md improvement
15
+
5
16
  ## [1.1.2] - 2024-04-07
6
17
 
7
18
  ### ⚙️ Miscellaneous Tasks
8
19
 
9
20
  - Add more logging
21
+ - Bump version
10
22
 
11
23
  ## [1.1.1] - 2024-04-07
12
24
 
package/out/qttest.d.ts CHANGED
@@ -15,6 +15,7 @@ export declare class QtTest {
15
15
  get id(): string;
16
16
  get label(): string;
17
17
  relativeFilename(): string;
18
+ filenameWithoutExtension(): string;
18
19
  /**
19
20
  * Calls "./yourqttest -functions" and stores the results in the slots property.
20
21
  */
@@ -71,6 +72,7 @@ export declare class QtTests {
71
72
  maintainMatching(regex: RegExp): void;
72
73
  dumpExecutablePaths(): void;
73
74
  dumpTestSlots(): Promise<void>;
75
+ executablesContainingSlot(slotName: string): QtTest[];
74
76
  }
75
77
  export interface TestFailure {
76
78
  name: string;
package/out/qttest.js CHANGED
@@ -80,6 +80,13 @@ class QtTest {
80
80
  result = result.replace(/\\/g, "/");
81
81
  return result;
82
82
  }
83
+ /// returns filename without .exe extension
84
+ filenameWithoutExtension() {
85
+ let result = this.filename;
86
+ if (result.endsWith(".exe"))
87
+ result = result.slice(0, -4);
88
+ return result;
89
+ }
83
90
  /**
84
91
  * Calls "./yourqttest -functions" and stores the results in the slots property.
85
92
  */
@@ -134,6 +141,8 @@ class QtTest {
134
141
  return undefined;
135
142
  }
136
143
  return new Promise((resolve, reject) => {
144
+ if (this.verbose)
145
+ logMessage("qttest: Running ldd on " + this.filename);
137
146
  const child = (0, child_process_1.spawn)("ldd", [this.filename]);
138
147
  let output = "";
139
148
  let result = false;
@@ -144,7 +153,7 @@ class QtTest {
144
153
  }
145
154
  }
146
155
  if (this.verbose)
147
- console.log(chunk.toString());
156
+ logMessage(chunk.toString());
148
157
  });
149
158
  child.on("exit", (code) => {
150
159
  if (code === 0) {
@@ -390,5 +399,15 @@ class QtTests {
390
399
  }
391
400
  });
392
401
  }
402
+ /// Returns all executables that contain a Qt test slot with the specified name
403
+ executablesContainingSlot(slotName) {
404
+ let result = [];
405
+ for (let ex of this.qtTestExecutables) {
406
+ if (ex.slotByName(slotName)) {
407
+ result.push(ex);
408
+ }
409
+ }
410
+ return result;
411
+ }
393
412
  }
394
413
  exports.QtTests = QtTests;
package/out/test.js CHANGED
@@ -92,6 +92,21 @@ function runTests(buildDirPath) {
92
92
  console.error("Expected test to fail: " + slot2.name);
93
93
  process.exit(1);
94
94
  }
95
+ // 5. Test executablesContainingSlot
96
+ let executables = qt.executablesContainingSlot("testB");
97
+ if (executables.length != 1) {
98
+ console.error("Expected 1 executable, got " + executables.length);
99
+ process.exit(1);
100
+ }
101
+ if (!executables[0].filenameWithoutExtension().endsWith("test1")) {
102
+ console.error("Expected filename to end with test1");
103
+ process.exit(1);
104
+ }
105
+ executables = qt.executablesContainingSlot("non_existing");
106
+ if (executables.length != 0) {
107
+ console.error("Expected 0 executables, got " + executables.length);
108
+ process.exit(1);
109
+ }
95
110
  });
96
111
  }
97
112
  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.1.2",
3
+ "version": "1.2.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",