@iamsergio/qttest-utils 1.0.0 โ†’ 1.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/Changelog CHANGED
@@ -2,6 +2,32 @@
2
2
 
3
3
 
4
4
 
5
+ ## [1.1.0] - 2024-04-07
6
+
7
+ ### ๐Ÿš€ Features
8
+
9
+ - Added QtTest.verbose property
10
+
11
+ ### ๐Ÿงช Testing
12
+
13
+ - Add a QBENCHMARK
14
+ - Fix tests on windows
15
+ - Fix more cases of wrong slashes
16
+ - Test linksToQtTestLib too
17
+
18
+ ### โš™๏ธ Miscellaneous Tasks
19
+
20
+ - Minor readme comment
21
+ - Update .npmignore
22
+ - Fix typo in README
23
+ - Fix badge urls in README
24
+ - Mention the vscode extension in the README
25
+ - Remove duplicate vscode workspace file
26
+ - Add macOS and Windows to CI
27
+ - Make npm install be verose
28
+ - Trying fixing the path for tsc on macos
29
+ - Update packages
30
+
5
31
  ## [1.0.0] - 2024-04-04
6
32
 
7
33
  ### ๐Ÿงช Testing
@@ -30,6 +56,8 @@
30
56
  - Bump to version 1.0.0
31
57
  - Regenerate out/
32
58
  - Add a CONTRIBUTING.md file
59
+ - Update changelog
60
+ - Add ci badges to readme
33
61
 
34
62
  ## [0.4.9] - 2023-04-06
35
63
 
package/README.md CHANGED
@@ -1,12 +1,14 @@
1
1
  # nodejs qttest-utils
2
2
 
3
- ![Build Status](https://github.com/qttest-utils/actions/workflows/ci.yml/badge.svg
4
- ![Pre-commit](https://github.com/qttest-utils/actions/workflows/pre-commit.yml/badge.svg
3
+ ![Build Status](https://github.com/KDAB/qttest-utils/actions/workflows/ci.yml/badge.svg)
4
+ ![Pre-commit](https://github.com/KDAB/qttest-utils/actions/workflows/pre-commit.yml/badge.svg)
5
5
 
6
6
  A [nodejs](https://www.npmjs.com/package/@iamsergio/qttest-utils) module for listing Qt Test executables and their individual test slots from a CMake build directory.
7
7
 
8
8
  To be used by vscode extensions that implement the `Testing API`, but can also be used standalone for whatever reason ;).
9
9
 
10
+ Used by [vscode-qttest](https://github.com/KDAB/vscode-qttest) extension.
11
+
10
12
  ## Installation
11
13
 
12
14
  ```bash
package/out/qttest.d.ts CHANGED
@@ -7,6 +7,7 @@ export declare function logMessage(message: string): void;
7
7
  export declare class QtTest {
8
8
  readonly filename: string;
9
9
  readonly buildDirPath: string;
10
+ verbose: boolean;
10
11
  vscodeTestItem: any | undefined;
11
12
  slots: QtTestSlot[] | null;
12
13
  lastExitCode: number;
package/out/qttest.js CHANGED
@@ -56,6 +56,8 @@ exports.logMessage = logMessage;
56
56
  */
57
57
  class QtTest {
58
58
  constructor(filename, buildDirPath) {
59
+ /// If true, will print more verbose output
60
+ this.verbose = false;
59
61
  /// The list of individual runnable test slots
60
62
  this.slots = null;
61
63
  /// Set after running
@@ -70,8 +72,13 @@ class QtTest {
70
72
  return path_1.default.basename(this.filename);
71
73
  }
72
74
  relativeFilename() {
73
- let current_dir = process.cwd();
74
- return this.filename.replace(current_dir + "/", "");
75
+ let result = path_1.default.relative(process.cwd(), this.filename);
76
+ // strip .exe, as we only use this for tests
77
+ if (result.endsWith(".exe"))
78
+ result = result.slice(0, -4);
79
+ // normalize slashes
80
+ result = result.replace(/\\/g, "/");
81
+ return result;
75
82
  }
76
83
  /**
77
84
  * Calls "./yourqttest -functions" and stores the results in the slots property.
@@ -83,7 +90,7 @@ class QtTest {
83
90
  let err = "";
84
91
  yield new Promise((resolve, reject) => {
85
92
  if (!fs.existsSync(this.filename)) {
86
- reject(new Error("File doesn't exit: " + this.filename));
93
+ reject(new Error("qttest: File doesn't exit: " + this.filename));
87
94
  return;
88
95
  }
89
96
  const child = (0, child_process_1.spawn)(this.filename, ["-functions"], { cwd: this.buildDirPath });
@@ -108,7 +115,7 @@ class QtTest {
108
115
  resolve(slotNames);
109
116
  }
110
117
  else {
111
- reject(new Error("Failed to run -functions, stdout=" + output + "; stderr=" + err + "; code=" + code));
118
+ reject(new Error("qttest: Failed to run -functions, stdout=" + output + "; stderr=" + err + "; code=" + code));
112
119
  }
113
120
  });
114
121
  });
@@ -136,13 +143,15 @@ class QtTest {
136
143
  result = true;
137
144
  }
138
145
  }
146
+ if (this.verbose)
147
+ console.log(chunk.toString());
139
148
  });
140
149
  child.on("exit", (code) => {
141
150
  if (code === 0) {
142
151
  resolve(result);
143
152
  }
144
153
  else {
145
- reject(new Error("Failed to run ldd"));
154
+ reject(new Error("qttest: Failed to run ldd"));
146
155
  }
147
156
  });
148
157
  });
@@ -183,8 +192,8 @@ class QtTest {
183
192
  return undefined;
184
193
  }
185
194
  /// Runs this test
186
- runTest(slot_1) {
187
- return __awaiter(this, arguments, void 0, function* (slot, cwd = "") {
195
+ runTest(slot, cwd = "") {
196
+ return __awaiter(this, void 0, void 0, function* () {
188
197
  let args = [];
189
198
  if (slot) {
190
199
  // Runs a single Qt test instead
package/out/test.js CHANGED
@@ -28,6 +28,7 @@ function runTests(buildDirPath) {
28
28
  console.error("Expected 3 executables, got " + qt.qtTestExecutables.length);
29
29
  process.exit(1);
30
30
  }
31
+ yield qt.removeNonLinking();
31
32
  // 1. Test that the executable test names are correct:
32
33
  var i = 0;
33
34
  for (var executable of qt.qtTestExecutables) {
@@ -70,6 +71,12 @@ function runTests(buildDirPath) {
70
71
  console.error("Expected test to pass: " + executable.filename);
71
72
  process.exit(1);
72
73
  }
74
+ if (process.platform === "linux") {
75
+ if (!executable.linksToQtTestLib()) {
76
+ console.error("Expected test to link to QtTest: " + executable.filename);
77
+ process.exit(1);
78
+ }
79
+ }
73
80
  i++;
74
81
  }
75
82
  // 4. Run individual slots:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iamsergio/qttest-utils",
3
- "version": "1.0.0",
3
+ "version": "1.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",
@@ -21,6 +21,6 @@
21
21
  "devDependencies": {
22
22
  "@types/node": "^18.15.0",
23
23
  "ts-node": "^10.9.1",
24
- "typescript": "^4.9.5"
24
+ "typescript": "^5.4.4"
25
25
  }
26
26
  }