test/integration: reenable staticcheck and fix "Error checking" test
Staticcheck has been supporting go1.18 for a while,
so reenable the skipped test.
https://go-review.googlesource.com/c/vscode-go/+/405551 rearranged
how diagnostics collection was passed. We need to pass them as goCtx.
Updates golang/vscode-go#1950
Fixes golang/vscode-go#2282
Change-Id: I9147e452bcfe61c8a5a260c0cca246dcc2375f0e
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/411104
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
diff --git a/.vscode/launch.json b/.vscode/launch.json
index ab3634d..418e3d2 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -63,6 +63,7 @@
"env": {
"VSCODE_GO_IN_TEST": "1", // Disable code that shouldn't be used in test
"MOCHA_TIMEOUT": "999999",
+ "MOCHA_GREP": "Error checking"
},
"stopOnEntry": false,
"sourceMaps": true,
diff --git a/test/integration/extension.test.ts b/test/integration/extension.test.ts
index 7fb2b92..6446c55 100644
--- a/test/integration/extension.test.ts
+++ b/test/integration/extension.test.ts
@@ -405,13 +405,7 @@
await testHoverProvider(config, testCases);
});
- test('Linting - concurrent process cancelation', async function () {
- if (!goVersion.lt('1.18')) {
- // TODO(hyangah): reenable test when staticcheck for go1.18 is released
- // https://github.com/dominikh/go-tools/issues/1145
- this.skip();
- }
-
+ test('Linting - concurrent process cancelation', async () => {
const util = require('../../src/util');
const processutil = require('../../src/utils/processUtils');
sinon.spy(util, 'runTool');
@@ -440,12 +434,7 @@
);
});
- test('Linting - lint errors with multiple open files', async function () {
- if (!goVersion.lt('1.18')) {
- // TODO(hyangah): reenable test when staticcheck for go1.18 is released
- // https://github.com/dominikh/go-tools/issues/1145
- this.skip();
- }
+ test('Linting - lint errors with multiple open files', async () => {
// handleDiagnosticErrors may adjust the lint errors' ranges to make the error more visible.
// This adjustment applies only to the text documents known to vscode. This test checks
// the adjustment is made consistently across multiple open text documents.
@@ -482,13 +471,7 @@
assert.deepStrictEqual(file1Diagnostics[0], file2Diagnostics[0]);
});
- test('Error checking', async function () {
- if (!goVersion.lt('1.18')) {
- // TODO(hyangah): reenable test when staticcheck for go1.18 is released
- // https://github.com/dominikh/go-tools/issues/1145
- this.skip();
- }
-
+ test('Error checking', async () => {
const config = Object.create(getGoConfig(), {
vetOnSave: { value: 'package' },
vetFlags: { value: ['-all'] },
@@ -515,7 +498,15 @@
// `check` itself doesn't run deDupeDiagnostics, so we expect all vet/lint errors.
const expected = [...expectedLintErrors, ...expectedBuildVetErrors];
- const diagnostics = await check({}, vscode.Uri.file(path.join(fixturePath, 'errorsTest', 'errors.go')), config);
+ const diagnostics = await check(
+ {
+ buildDiagnosticCollection: vscode.languages.createDiagnosticCollection('buildtest'),
+ lintDiagnosticCollection: vscode.languages.createDiagnosticCollection('linttest'),
+ vetDiagnosticCollection: vscode.languages.createDiagnosticCollection('vettest')
+ },
+ vscode.Uri.file(path.join(fixturePath, 'errorsTest', 'errors.go')),
+ config
+ );
const sortedDiagnostics = ([] as ICheckResult[]).concat
.apply(
[],