Skip to content

Commit

Permalink
test/integration: reenable staticcheck and fix "Error checking" test
Browse files Browse the repository at this point in the history
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#1950
Fixes golang#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>
  • Loading branch information
hyangah committed Jun 9, 2022
1 parent 8ebd092 commit 8bc0703
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 21 deletions.
1 change: 1 addition & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
33 changes: 12 additions & 21 deletions test/integration/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,13 +405,7 @@ It returns the number of bytes written and any write error encountered.
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');
Expand Down Expand Up @@ -440,12 +434,7 @@ It returns the number of bytes written and any write error encountered.
);
});

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.
Expand Down Expand Up @@ -482,13 +471,7 @@ It returns the number of bytes written and any write error encountered.
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'] },
Expand All @@ -515,7 +498,15 @@ It returns the number of bytes written and any write error encountered.

// `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(
[],
Expand Down

0 comments on commit 8bc0703

Please sign in to comment.