Add separate command for "Accept Output" on test item context menu
This commit is contained in:
@@ -682,6 +682,10 @@
|
||||
"command": "codeQLTests.acceptOutput",
|
||||
"title": "Accept Test Output"
|
||||
},
|
||||
{
|
||||
"command": "codeQLTests.acceptOutputContextTestItem",
|
||||
"title": "Accept Test Output"
|
||||
},
|
||||
{
|
||||
"command": "codeQLAstViewer.gotoCode",
|
||||
"title": "Go To Code"
|
||||
@@ -979,7 +983,7 @@
|
||||
],
|
||||
"testing/item/context": [
|
||||
{
|
||||
"command": "codeQLTests.acceptOutput",
|
||||
"command": "codeQLTests.acceptOutputContextTestItem",
|
||||
"group": "qltest@1",
|
||||
"when": "controllerId == codeql && testId =~ /^test /"
|
||||
}
|
||||
@@ -1332,6 +1336,10 @@
|
||||
{
|
||||
"command": "codeQL.createQuery",
|
||||
"when": "config.codeQL.canary"
|
||||
},
|
||||
{
|
||||
"command": "codeQLTests.acceptOutputContextTestItem",
|
||||
"when": "false"
|
||||
}
|
||||
],
|
||||
"editor/context": [
|
||||
|
||||
@@ -298,6 +298,9 @@ export type SummaryLanguageSupportCommands = {
|
||||
export type TestUICommands = {
|
||||
"codeQLTests.showOutputDifferences": (node: TestTreeNode) => Promise<void>;
|
||||
"codeQLTests.acceptOutput": (node: TestTreeNode) => Promise<void>;
|
||||
"codeQLTests.acceptOutputContextTestItem": (
|
||||
node: TestTreeNode,
|
||||
) => Promise<void>;
|
||||
};
|
||||
|
||||
export type MockGitHubApiServerCommands = {
|
||||
|
||||
@@ -3,7 +3,6 @@ import { TestUICommands } from "./common/commands";
|
||||
import { DisposableObject } from "./pure/disposable-object";
|
||||
import { getActualFile, getExpectedFile } from "./test-adapter";
|
||||
import { TestItem, TextDocumentShowOptions, Uri, window } from "vscode";
|
||||
import { showAndLogWarningMessage } from "./helpers";
|
||||
import { basename } from "path";
|
||||
import { App } from "./common/app";
|
||||
import { TestTreeNode } from "./test-tree-node";
|
||||
@@ -24,6 +23,7 @@ export abstract class TestManagerBase extends DisposableObject {
|
||||
"codeQLTests.showOutputDifferences":
|
||||
this.showOutputDifferences.bind(this),
|
||||
"codeQLTests.acceptOutput": this.acceptOutput.bind(this),
|
||||
"codeQLTests.acceptOutputContextTestItem": this.acceptOutput.bind(this),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -53,9 +53,7 @@ export abstract class TestManagerBase extends DisposableObject {
|
||||
};
|
||||
|
||||
if (!(await pathExists(expectedPath))) {
|
||||
void showAndLogWarningMessage(
|
||||
`'${basename(expectedPath)}' does not exist. Creating an empty file.`,
|
||||
);
|
||||
// Just create a new file.
|
||||
await createFile(expectedPath);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user