Skip to content

Commit 44193a8

Browse files
fix tests
1 parent 17f3dfe commit 44193a8

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

src/extension/telemetry/reporter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
import TelemetryReporter from "@vscode/extension-telemetry";
5-
import { AppinsightsKey, isTestExecution } from "../common/constants";
4+
import TelemetryReporter from '@vscode/extension-telemetry';
5+
import { AppinsightsKey, isTestExecution } from '../common/constants';
66

77
export function getTelemetryReporter(telemetryReporter: TelemetryReporter | undefined) {
88
if (!isTestExecution() && telemetryReporter) {

src/test/unittest/adapter/factory.unit.test.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { expect, use } from 'chai';
99
import * as chaiAsPromised from 'chai-as-promised';
1010
import * as path from 'path';
1111
import * as sinon from 'sinon';
12-
// import rewiremock from 'rewiremock';
1312
import { SemVer } from 'semver';
1413
import { instance, mock, when } from 'ts-mockito';
1514
import { DebugAdapterExecutable, DebugAdapterServer, DebugConfiguration, DebugSession, WorkspaceFolder } from 'vscode';
@@ -37,7 +36,6 @@ suite('Debugging - Adapter Factory', () => {
3736
let getInterpretersStub: sinon.SinonStub;
3837
let getInterpreterDetailsStub: sinon.SinonStub;
3938
let hasInterpretersStub: sinon.SinonStub;
40-
// let sendTelemetryEventStub: sinon.SinonStub;
4139
let getTelemetryReporterStub: sinon.SinonStub;
4240
let reporter: any;
4341

@@ -78,7 +76,6 @@ suite('Debugging - Adapter Factory', () => {
7876
getInterpretersStub = sinon.stub(pythonApi, 'getInterpreters');
7977
getInterpreterDetailsStub = sinon.stub(pythonApi, 'getInterpreterDetails');
8078
hasInterpretersStub = sinon.stub(pythonApi, 'hasInterpreters');
81-
// sendTelemetryEventStub = sinon.stub(telemetry, 'sendTelemetryEvent');
8279
getTelemetryReporterStub = sinon.stub(telemetryReporter, 'getTelemetryReporter');
8380

8481
when(
@@ -93,10 +90,9 @@ suite('Debugging - Adapter Factory', () => {
9390
teardown(() => {
9491
process.env.VSC_PYTHON_UNIT_TEST = oldValueOfVSC_PYTHON_UNIT_TEST;
9592
process.env.VSC_PYTHON_CI_TEST = oldValueOfVSC_PYTHON_CI_TEST;
96-
reporter.properties = [];
97-
reporter.eventNames = [];
98-
reporter.measures = [];
99-
// rewiremock.disable();
93+
Reporter.properties = [];
94+
Reporter.eventNames = [];
95+
Reporter.measures = [];
10096
telemetry.clearTelemetryReporter();
10197
sinon.restore();
10298
});
@@ -265,14 +261,14 @@ suite('Debugging - Adapter Factory', () => {
265261
assert.deepStrictEqual(descriptor, debugExecutable);
266262
});
267263

268-
test.only('Send attach to local process telemetry if attaching to a local process', async () => {
264+
test('Send attach to local process telemetry if attaching to a local process', async () => {
269265
const session = createSession({ request: 'attach', processId: 1234 });
270266
getInterpreterDetailsStub.resolves({ path: [interpreter.path] });
271267
resolveEnvironmentStub.withArgs(interpreter.path).resolves(interpreter);
272268

273269
await factory.createDebugAdapterDescriptor(session, nodeExecutable);
274270

275-
assert.ok(reporter.eventNames.includes(EventName.DEBUGGER_ATTACH_TO_LOCAL_PROCESS));
271+
assert.ok(Reporter.eventNames.includes(EventName.DEBUGGER_ATTACH_TO_LOCAL_PROCESS));
276272
});
277273

278274
test("Don't send any telemetry if not attaching to a local process", async () => {

0 commit comments

Comments
 (0)