mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-02 06:21:50 +01:00
eng: make it selfhost failure log easier to access and more stable (#212626)
This commit is contained in:
@@ -4,8 +4,9 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { spawn } from 'child_process';
|
||||
import { existsSync, mkdirSync, renameSync } from 'fs';
|
||||
import { readFile, writeFile } from 'fs/promises';
|
||||
import { join } from 'path';
|
||||
import { dirname, join } from 'path';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
interface IGitState {
|
||||
@@ -29,10 +30,29 @@ export class FailureTracker {
|
||||
{ snapshot: vscode.TestResultSnapshot; failing: IGitState }
|
||||
>();
|
||||
|
||||
private readonly logFile = join(this.rootDir, '.build/vscode-test-failures.json');
|
||||
private readonly logFile: string;
|
||||
private logs?: ITrackedRemediation[];
|
||||
|
||||
constructor(private readonly rootDir: string) {
|
||||
constructor(context: vscode.ExtensionContext, private readonly rootDir: string) {
|
||||
this.logFile = join(context.globalStorageUri.fsPath, '.build/vscode-test-failures.json');
|
||||
mkdirSync(dirname(this.logFile), { recursive: true });
|
||||
|
||||
const oldLogFile = join(rootDir, '.build/vscode-test-failures.json');
|
||||
if (existsSync(oldLogFile)) {
|
||||
try {
|
||||
renameSync(oldLogFile, this.logFile);
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
this.disposables.push(
|
||||
vscode.commands.registerCommand('selfhost-test-provider.openFailureLog', async () => {
|
||||
const doc = await vscode.workspace.openTextDocument(this.logFile);
|
||||
await vscode.window.showTextDocument(doc);
|
||||
})
|
||||
);
|
||||
|
||||
this.disposables.push(
|
||||
vscode.tests.onDidChangeTestResults(() => {
|
||||
const last = vscode.tests.testResults[0];
|
||||
|
||||
Reference in New Issue
Block a user