Skip to content

Commit 8f29e1c

Browse files
author
Dave Bartolomeo
committed
Add separate command for "Accept Output" on test item context menu
1 parent c963cf6 commit 8f29e1c

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

extensions/ql-vscode/package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,10 @@
682682
"command": "codeQLTests.acceptOutput",
683683
"title": "Accept Test Output"
684684
},
685+
{
686+
"command": "codeQLTests.acceptOutputContextTestItem",
687+
"title": "Accept Test Output"
688+
},
685689
{
686690
"command": "codeQLAstViewer.gotoCode",
687691
"title": "Go To Code"
@@ -979,7 +983,7 @@
979983
],
980984
"testing/item/context": [
981985
{
982-
"command": "codeQLTests.acceptOutput",
986+
"command": "codeQLTests.acceptOutputContextTestItem",
983987
"group": "qltest@1",
984988
"when": "controllerId == codeql && testId =~ /^test /"
985989
}
@@ -1332,6 +1336,10 @@
13321336
{
13331337
"command": "codeQL.createQuery",
13341338
"when": "config.codeQL.canary"
1339+
},
1340+
{
1341+
"command": "codeQLTests.acceptOutputContextTestItem",
1342+
"when": "false"
13351343
}
13361344
],
13371345
"editor/context": [

extensions/ql-vscode/src/common/commands.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,9 @@ export type SummaryLanguageSupportCommands = {
298298
export type TestUICommands = {
299299
"codeQLTests.showOutputDifferences": (node: TestTreeNode) => Promise<void>;
300300
"codeQLTests.acceptOutput": (node: TestTreeNode) => Promise<void>;
301+
"codeQLTests.acceptOutputContextTestItem": (
302+
node: TestTreeNode,
303+
) => Promise<void>;
301304
};
302305

303306
export type MockGitHubApiServerCommands = {

extensions/ql-vscode/src/test-manager-base.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { TestUICommands } from "./common/commands";
33
import { DisposableObject } from "./pure/disposable-object";
44
import { getActualFile, getExpectedFile } from "./test-adapter";
55
import { TestItem, TextDocumentShowOptions, Uri, window } from "vscode";
6-
import { showAndLogWarningMessage } from "./helpers";
76
import { basename } from "path";
87
import { App } from "./common/app";
98
import { TestTreeNode } from "./test-tree-node";
@@ -24,6 +23,7 @@ export abstract class TestManagerBase extends DisposableObject {
2423
"codeQLTests.showOutputDifferences":
2524
this.showOutputDifferences.bind(this),
2625
"codeQLTests.acceptOutput": this.acceptOutput.bind(this),
26+
"codeQLTests.acceptOutputContextTestItem": this.acceptOutput.bind(this),
2727
};
2828
}
2929

@@ -53,9 +53,7 @@ export abstract class TestManagerBase extends DisposableObject {
5353
};
5454

5555
if (!(await pathExists(expectedPath))) {
56-
void showAndLogWarningMessage(
57-
`'${basename(expectedPath)}' does not exist. Creating an empty file.`,
58-
);
56+
// Just create a new file.
5957
await createFile(expectedPath);
6058
}
6159

0 commit comments

Comments
 (0)