@iamsergio/qttest-utils 1.3.0 → 2.0.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,26 @@
2
2
 
3
3
 
4
4
 
5
+ ## [2.0.0] - 2024-04-24
6
+
7
+ ### 🚀 Features
8
+
9
+ - [**breaking**] Use a member to hold the output function
10
+
11
+ ## [1.4.0] - 2024-04-24
12
+
13
+ ### 🚀 Features
14
+
15
+ - Allow the caller to pass a output callback
16
+
17
+ ### 🐛 Bug Fixes
18
+
19
+ - When running a qttest, output to stdout
20
+
21
+ ### ⚙️ Miscellaneous Tasks
22
+
23
+ - Bump version
24
+
5
25
  ## [1.3.0] - 2024-04-23
6
26
 
7
27
  ### 🚀 Features
@@ -18,6 +38,7 @@
18
38
  ### ⚙️ Miscellaneous Tasks
19
39
 
20
40
  - Add more logging
41
+ - Bump version
21
42
 
22
43
  ## [1.2.0] - 2024-04-22
23
44
 
package/out/qttest.d.ts CHANGED
@@ -11,6 +11,7 @@ export declare class QtTest {
11
11
  vscodeTestItem: any | undefined;
12
12
  slots: QtTestSlot[] | null;
13
13
  lastExitCode: number;
14
+ outputFunc: LoggerFunction | undefined;
14
15
  constructor(filename: string, buildDirPath: string);
15
16
  get id(): string;
16
17
  get label(): string;
package/out/qttest.js CHANGED
@@ -62,6 +62,8 @@ class QtTest {
62
62
  this.slots = null;
63
63
  /// Set after running
64
64
  this.lastExitCode = 0;
65
+ /// Allows the caller to receive the output of the test process
66
+ this.outputFunc = undefined;
65
67
  this.filename = filename;
66
68
  this.buildDirPath = buildDirPath;
67
69
  }
@@ -211,15 +213,27 @@ class QtTest {
211
213
  else {
212
214
  this.clearSubTestStates();
213
215
  }
214
- // log to file
216
+ // log to file and to stdout
215
217
  args = args.concat("-o").concat(this.tapOutputFileName(slot) + ",tap");
216
218
  args = args.concat("-o").concat(this.txtOutputFileName(slot) + ",txt");
219
+ args = args.concat("-o").concat("-,txt");
217
220
  return yield new Promise((resolve, reject) => {
218
221
  let cwdDir = cwd.length > 0 ? cwd : this.buildDirPath;
219
222
  logMessage("Running " + this.filename + " " + args.join(" ") + " with cwd=" + cwdDir);
220
223
  const child = (0, child_process_1.spawn)(this.filename, args, { cwd: cwdDir });
224
+ if (this.outputFunc) {
225
+ // Callers wants the process output:
226
+ child.stdout.on("data", (chunk) => {
227
+ if (this.outputFunc)
228
+ this.outputFunc(chunk.toString());
229
+ });
230
+ child.stderr.on("data", (chunk) => {
231
+ if (this.outputFunc)
232
+ this.outputFunc(chunk.toString());
233
+ });
234
+ }
221
235
  child.on("exit", (code) => __awaiter(this, void 0, void 0, function* () {
222
- /// We can code even be null ?
236
+ /// Can code even be null ?
223
237
  if (code == undefined)
224
238
  code = -1;
225
239
  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": "2.0.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",