Skip to content

Commit 1a63ba8

Browse files
committed
chore: Add some more logs for troubleshooting
1 parent 86050da commit 1a63ba8

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/runner.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export class TestRunner {
5353
const workingDir = path.dirname(config.uri.fsPath);
5454

5555
return async (request) => {
56+
const runStart = performance.now();
5657
this.logChannel.debug('Creating new test run ', request);
5758

5859
const run = ctrl.createTestRun(request);
@@ -79,7 +80,9 @@ export class TestRunner {
7980
};
8081

8182
const spawnCts = new vscode.CancellationTokenSource();
82-
run.token.onCancellationRequested(() => spawnCts.cancel());
83+
run.token.onCancellationRequested(() => {
84+
spawnCts.cancel();
85+
});
8386

8487
const spawnOpts: ISpawnOptions = {
8588
args,
@@ -217,11 +220,14 @@ export class TestRunner {
217220
);
218221

219222
try {
223+
const start = performance.now();
220224
if (debug) {
221225
await this.runDebug(spawnOpts);
222226
} else {
223227
await this.runWithoutDebug(spawnOpts);
224228
}
229+
const end = performance.now();
230+
this.logChannel.info(`Completed test execution after ${end - start}ms`);
225231
} catch (e) {
226232
const errorMessage = e instanceof Error ? e : `Error executing tests ${e}`;
227233
this.logChannel.error(errorMessage);
@@ -253,6 +259,9 @@ export class TestRunner {
253259

254260
await outputQueue.drain();
255261
run.end();
262+
263+
const runEnd = performance.now();
264+
this.logChannel.debug(`Whole testrun completed after ${runEnd - runStart}ms`);
256265
};
257266
}
258267

@@ -365,12 +374,15 @@ export class TestRunner {
365374
return cli.kill();
366375
}
367376

368-
token.onCancellationRequested(() => cli.kill());
377+
token.onCancellationRequested(() => {
378+
cli.kill();
379+
});
369380
cli.stderr.pipe(split2()).on('data', onLine);
370381
cli.stdout.pipe(split2()).on('data', onLine);
371382
return new Promise<void>((resolve, reject) => {
372383
cli.on('error', reject);
373-
cli.on('exit', (code) => {
384+
cli.on('close', (code) => {
385+
this.logChannel.trace('Test Process closed');
374386
if (code === 0) {
375387
resolve();
376388
} else {

0 commit comments

Comments
 (0)