@iamsergio/qttest-utils 1.4.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,12 @@
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
+
5
11
  ## [1.4.0] - 2024-04-24
6
12
 
7
13
  ### 🚀 Features
@@ -12,6 +18,10 @@
12
18
 
13
19
  - When running a qttest, output to stdout
14
20
 
21
+ ### ⚙️ Miscellaneous Tasks
22
+
23
+ - Bump version
24
+
15
25
  ## [1.3.0] - 2024-04-23
16
26
 
17
27
  ### 🚀 Features
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;
@@ -30,7 +31,7 @@ export declare class QtTest {
30
31
  linksToQtTestLib(): Promise<boolean> | undefined;
31
32
  isQtTestViaHelp(): Promise<boolean | undefined>;
32
33
  slotByName(name: string): QtTestSlot | undefined;
33
- runTest(slot?: QtTestSlot, cwd?: string, outputFunc?: LoggerFunction | undefined): Promise<boolean>;
34
+ runTest(slot?: QtTestSlot, cwd?: string): Promise<boolean>;
34
35
  tapOutputFileName(slot?: QtTestSlot): string;
35
36
  txtOutputFileName(slot?: QtTestSlot): string;
36
37
  command(): {
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
  }
@@ -201,7 +203,7 @@ class QtTest {
201
203
  return undefined;
202
204
  }
203
205
  /// Runs this test
204
- runTest(slot, cwd = "", outputFunc = undefined) {
206
+ runTest(slot, cwd = "") {
205
207
  return __awaiter(this, void 0, void 0, function* () {
206
208
  let args = [];
207
209
  if (slot) {
@@ -219,13 +221,15 @@ class QtTest {
219
221
  let cwdDir = cwd.length > 0 ? cwd : this.buildDirPath;
220
222
  logMessage("Running " + this.filename + " " + args.join(" ") + " with cwd=" + cwdDir);
221
223
  const child = (0, child_process_1.spawn)(this.filename, args, { cwd: cwdDir });
222
- if (outputFunc) {
224
+ if (this.outputFunc) {
223
225
  // Callers wants the process output:
224
226
  child.stdout.on("data", (chunk) => {
225
- outputFunc(chunk.toString());
227
+ if (this.outputFunc)
228
+ this.outputFunc(chunk.toString());
226
229
  });
227
230
  child.stderr.on("data", (chunk) => {
228
- outputFunc(chunk.toString());
231
+ if (this.outputFunc)
232
+ this.outputFunc(chunk.toString());
229
233
  });
230
234
  }
231
235
  child.on("exit", (code) => __awaiter(this, void 0, void 0, function* () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iamsergio/qttest-utils",
3
- "version": "1.4.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",