@iamsergio/qttest-utils 0.2.0 → 0.3.1

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/out/qttest.d.ts CHANGED
@@ -22,6 +22,11 @@ export declare class QtTest {
22
22
  linksToQtTestLib(): Promise<boolean> | undefined;
23
23
  isQtTestViaHelp(): Promise<boolean | undefined>;
24
24
  runTest(slotName?: string): Promise<boolean>;
25
+ command(): {
26
+ label: string;
27
+ executablePath: string;
28
+ args: string[];
29
+ };
25
30
  }
26
31
  /**
27
32
  * Represents a single Qt test slot
@@ -33,6 +38,11 @@ export declare class QtTestSlot {
33
38
  get id(): string;
34
39
  get absoluteFilePath(): string;
35
40
  runTest(): Promise<boolean>;
41
+ command(): {
42
+ label: string;
43
+ executablePath: string;
44
+ args: string[];
45
+ };
36
46
  }
37
47
  /**
38
48
  * Represents the list of all QtTest executables in your project
package/out/qttest.js CHANGED
@@ -150,6 +150,9 @@ class QtTest {
150
150
  });
151
151
  });
152
152
  }
153
+ command() {
154
+ return { label: this.label, executablePath: this.filename, args: [] };
155
+ }
153
156
  }
154
157
  exports.QtTest = QtTest;
155
158
  /**
@@ -171,6 +174,9 @@ class QtTestSlot {
171
174
  return this.parentQTest.runTest(this.name);
172
175
  });
173
176
  }
177
+ command() {
178
+ return { label: this.name, executablePath: this.absoluteFilePath, args: [this.name] };
179
+ }
174
180
  }
175
181
  exports.QtTestSlot = QtTestSlot;
176
182
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iamsergio/qttest-utils",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
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
  "scripts": {
6
6
  "build": "tsc"
@@ -19,4 +19,4 @@
19
19
  "ts-node": "^10.9.1",
20
20
  "typescript": "^4.9.5"
21
21
  }
22
- }
22
+ }
package/src/qttest.ts CHANGED
@@ -32,6 +32,7 @@ export class QtTest {
32
32
  public async parseAvailableSlots(): Promise<void> {
33
33
  let slotNames: string[] = [];
34
34
  let output = "";
35
+ let err = "";
35
36
 
36
37
  await new Promise((resolve, reject) => {
37
38
  const child = spawn(this.filename, ["-functions"]);
@@ -40,6 +41,10 @@ export class QtTest {
40
41
  output += chunk.toString();
41
42
  });
42
43
 
44
+ child.stderr.on("data", (chunk) => {
45
+ err += chunk.toString();
46
+ });
47
+
43
48
  child.on("exit", (code) => {
44
49
  if (code === 0) {
45
50
  slotNames = slotNames.concat(output.split("\n"));
@@ -56,7 +61,7 @@ export class QtTest {
56
61
 
57
62
  resolve(slotNames);
58
63
  } else {
59
- reject(new Error("Failed to run -functions"));
64
+ reject(new Error("Failed to run -functions, stdout=" + output + "; stderr=" + err + "; code=" + code));
60
65
  }
61
66
  });
62
67
  });
@@ -144,6 +149,10 @@ export class QtTest {
144
149
  });
145
150
  });
146
151
  }
152
+
153
+ public command(): { label: string, executablePath: string, args: string[] } {
154
+ return { label: this.label, executablePath: this.filename, args: [] };
155
+ }
147
156
  }
148
157
 
149
158
  /**
@@ -171,6 +180,10 @@ export class QtTestSlot {
171
180
  public async runTest(): Promise<boolean> {
172
181
  return this.parentQTest.runTest(this.name);
173
182
  }
183
+
184
+ public command(): { label: string, executablePath: string, args: string[] } {
185
+ return { label: this.name, executablePath: this.absoluteFilePath, args: [this.name] };
186
+ }
174
187
  }
175
188
 
176
189
  /**