@iamsergio/qttest-utils 1.3.0 → 1.4.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,16 @@
2
2
 
3
3
 
4
4
 
5
+ ## [1.4.0] - 2024-04-24
6
+
7
+ ### 🚀 Features
8
+
9
+ - Allow the caller to pass a output callback
10
+
11
+ ### 🐛 Bug Fixes
12
+
13
+ - When running a qttest, output to stdout
14
+
5
15
  ## [1.3.0] - 2024-04-23
6
16
 
7
17
  ### 🚀 Features
@@ -18,6 +28,7 @@
18
28
  ### ⚙️ Miscellaneous Tasks
19
29
 
20
30
  - Add more logging
31
+ - Bump version
21
32
 
22
33
  ## [1.2.0] - 2024-04-22
23
34
 
package/out/qttest.d.ts CHANGED
@@ -30,7 +30,7 @@ export declare class QtTest {
30
30
  linksToQtTestLib(): Promise<boolean> | undefined;
31
31
  isQtTestViaHelp(): Promise<boolean | undefined>;
32
32
  slotByName(name: string): QtTestSlot | undefined;
33
- runTest(slot?: QtTestSlot, cwd?: string): Promise<boolean>;
33
+ runTest(slot?: QtTestSlot, cwd?: string, outputFunc?: LoggerFunction | undefined): Promise<boolean>;
34
34
  tapOutputFileName(slot?: QtTestSlot): string;
35
35
  txtOutputFileName(slot?: QtTestSlot): string;
36
36
  command(): {
package/out/qttest.js CHANGED
@@ -201,7 +201,7 @@ class QtTest {
201
201
  return undefined;
202
202
  }
203
203
  /// Runs this test
204
- runTest(slot, cwd = "") {
204
+ runTest(slot, cwd = "", outputFunc = undefined) {
205
205
  return __awaiter(this, void 0, void 0, function* () {
206
206
  let args = [];
207
207
  if (slot) {
@@ -211,15 +211,25 @@ class QtTest {
211
211
  else {
212
212
  this.clearSubTestStates();
213
213
  }
214
- // log to file
214
+ // log to file and to stdout
215
215
  args = args.concat("-o").concat(this.tapOutputFileName(slot) + ",tap");
216
216
  args = args.concat("-o").concat(this.txtOutputFileName(slot) + ",txt");
217
+ args = args.concat("-o").concat("-,txt");
217
218
  return yield new Promise((resolve, reject) => {
218
219
  let cwdDir = cwd.length > 0 ? cwd : this.buildDirPath;
219
220
  logMessage("Running " + this.filename + " " + args.join(" ") + " with cwd=" + cwdDir);
220
221
  const child = (0, child_process_1.spawn)(this.filename, args, { cwd: cwdDir });
222
+ if (outputFunc) {
223
+ // Callers wants the process output:
224
+ child.stdout.on("data", (chunk) => {
225
+ outputFunc(chunk.toString());
226
+ });
227
+ child.stderr.on("data", (chunk) => {
228
+ outputFunc(chunk.toString());
229
+ });
230
+ }
221
231
  child.on("exit", (code) => __awaiter(this, void 0, void 0, function* () {
222
- /// We can code even be null ?
232
+ /// Can code even be null ?
223
233
  if (code == undefined)
224
234
  code = -1;
225
235
  if (!slot) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iamsergio/qttest-utils",
3
- "version": "1.3.0",
3
+ "version": "1.4.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",