Skip to content

Commit 8bc0703

Browse files
committed
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 #1950 Fixes #2282 Change-Id: I9147e452bcfe61c8a5a260c0cca246dcc2375f0e Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/411104 Run-TryBot: Hyang-Ah Hana Kim <[email protected]> Reviewed-by: Jamal Carvalho <[email protected]> TryBot-Result: kokoro <[email protected]>
1 parent 8ebd092 commit 8bc0703

File tree

2 files changed

+13
-21
lines changed

2 files changed

+13
-21
lines changed

.vscode/launch.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"env": {
6464
"VSCODE_GO_IN_TEST": "1", // Disable code that shouldn't be used in test
6565
"MOCHA_TIMEOUT": "999999",
66+
"MOCHA_GREP": "Error checking"
6667
},
6768
"stopOnEntry": false,
6869
"sourceMaps": true,

test/integration/extension.test.ts

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -405,13 +405,7 @@ It returns the number of bytes written and any write error encountered.
405405
await testHoverProvider(config, testCases);
406406
});
407407

408-
test('Linting - concurrent process cancelation', async function () {
409-
if (!goVersion.lt('1.18')) {
410-
// TODO(hyangah): reenable test when staticcheck for go1.18 is released
411-
// https://github.com/dominikh/go-tools/issues/1145
412-
this.skip();
413-
}
414-
408+
test('Linting - concurrent process cancelation', async () => {
415409
const util = require('../../src/util');
416410
const processutil = require('../../src/utils/processUtils');
417411
sinon.spy(util, 'runTool');
@@ -440,12 +434,7 @@ It returns the number of bytes written and any write error encountered.
440434
);
441435
});
442436

443-
test('Linting - lint errors with multiple open files', async function () {
444-
if (!goVersion.lt('1.18')) {
445-
// TODO(hyangah): reenable test when staticcheck for go1.18 is released
446-
// https://github.com/dominikh/go-tools/issues/1145
447-
this.skip();
448-
}
437+
test('Linting - lint errors with multiple open files', async () => {
449438
// handleDiagnosticErrors may adjust the lint errors' ranges to make the error more visible.
450439
// This adjustment applies only to the text documents known to vscode. This test checks
451440
// the adjustment is made consistently across multiple open text documents.
@@ -482,13 +471,7 @@ It returns the number of bytes written and any write error encountered.
482471
assert.deepStrictEqual(file1Diagnostics[0], file2Diagnostics[0]);
483472
});
484473

485-
test('Error checking', async function () {
486-
if (!goVersion.lt('1.18')) {
487-
// TODO(hyangah): reenable test when staticcheck for go1.18 is released
488-
// https://github.com/dominikh/go-tools/issues/1145
489-
this.skip();
490-
}
491-
474+
test('Error checking', async () => {
492475
const config = Object.create(getGoConfig(), {
493476
vetOnSave: { value: 'package' },
494477
vetFlags: { value: ['-all'] },
@@ -515,7 +498,15 @@ It returns the number of bytes written and any write error encountered.
515498

516499
// `check` itself doesn't run deDupeDiagnostics, so we expect all vet/lint errors.
517500
const expected = [...expectedLintErrors, ...expectedBuildVetErrors];
518-
const diagnostics = await check({}, vscode.Uri.file(path.join(fixturePath, 'errorsTest', 'errors.go')), config);
501+
const diagnostics = await check(
502+
{
503+
buildDiagnosticCollection: vscode.languages.createDiagnosticCollection('buildtest'),
504+
lintDiagnosticCollection: vscode.languages.createDiagnosticCollection('linttest'),
505+
vetDiagnosticCollection: vscode.languages.createDiagnosticCollection('vettest')
506+
},
507+
vscode.Uri.file(path.join(fixturePath, 'errorsTest', 'errors.go')),
508+
config
509+
);
519510
const sortedDiagnostics = ([] as ICheckResult[]).concat
520511
.apply(
521512
[],

0 commit comments

Comments
 (0)