Skip to content

Commit 0c516ef

Browse files
authored
Bug fix, check if code has been ignored (#2001)
Fixes #1698
1 parent bd1b746 commit 0c516ef

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/client/application/diagnostics/checks/envPathVariable.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ export class EnvironmentPathVariableDiagnosticsService extends BaseDiagnosticsSe
5454
return;
5555
}
5656
const diagnostic = diagnostics[0];
57+
if (this.filterService.shouldIgnoreDiagnostic(diagnostic.code)) {
58+
return;
59+
}
5760
const commandFactory = this.serviceContainer.get<IDiagnosticsCommandFactory>(IDiagnosticsCommandFactory);
5861
const options = [
5962
{

src/test/application/diagnostics/checks/envPathVariable.unit.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,26 @@ suite('Application Diagnostics - Checks Env Path Variable', () => {
158158
commandFactory.verifyAll();
159159
messageHandler.verifyAll();
160160
});
161+
test('Should not display a message if the diagnostic code has been ignored', async () => {
162+
platformService.setup(p => p.isWindows).returns(() => true);
163+
const diagnostic = typemoq.Mock.ofType<IDiagnostic>();
164+
165+
filterService.setup(f => f.shouldIgnoreDiagnostic(typemoq.It.isValue(DiagnosticCodes.InvalidEnvironmentPathVariableDiagnostic)))
166+
.returns(() => Promise.resolve(true))
167+
.verifiable(typemoq.Times.once());
168+
diagnostic.setup(d => d.code)
169+
.returns(() => DiagnosticCodes.InvalidEnvironmentPathVariableDiagnostic)
170+
.verifiable(typemoq.Times.atLeastOnce());
171+
commandFactory.setup(f => f.createCommand(typemoq.It.isAny(), typemoq.It.isAny()))
172+
.verifiable(typemoq.Times.never());
173+
messageHandler.setup(m => m.handle(typemoq.It.isAny(), typemoq.It.isAny()))
174+
.verifiable(typemoq.Times.never());
175+
176+
await diagnosticService.handle([diagnostic.object]);
177+
178+
filterService.verifyAll();
179+
diagnostic.verifyAll();
180+
commandFactory.verifyAll();
181+
messageHandler.verifyAll();
182+
});
161183
});

0 commit comments

Comments
 (0)