Skip to content

Commit

Permalink
Remove dependency on ts-mock-imports. (microsoft#18425)
Browse files Browse the repository at this point in the history
  • Loading branch information
karthiknadig authored Feb 3, 2022
1 parent df49596 commit b38ea75
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 33 deletions.
1 change: 1 addition & 0 deletions news/3 Code Health/14757.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove dependency on `ts-mock-imports`.
18 changes: 0 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2049,7 +2049,6 @@
"sinon": "^8.0.1",
"source-map-support": "^0.5.12",
"ts-loader": "^5.3.0",
"ts-mock-imports": "^1.3.0",
"ts-mockito": "^2.5.0",
"ts-node": "^8.3.0",
"tsconfig-paths-webpack-plugin": "^3.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import * as assert from 'assert';
import * as sinon from 'sinon';
import { ImportMock } from 'ts-mock-imports';
import { SemVer } from 'semver';
import { ExecutionResult } from '../../../../client/common/process/types';
import { IDisposableRegistry } from '../../../../client/common/types';
Expand Down Expand Up @@ -42,9 +41,8 @@ suite('Environment Info Service', () => {

setup(() => {
disposables = [];
stubShellExec = ImportMock.mockFunction(
ExternalDep,
'shellExecute',
stubShellExec = sinon.stub(ExternalDep, 'shellExecute');
stubShellExec.returns(
new Promise<ExecutionResult<string>>((resolve) => {
resolve({
stdout:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { assert } from 'chai';
import { cloneDeep } from 'lodash';
import * as path from 'path';
import * as sinon from 'sinon';
import { ImportMock } from 'ts-mock-imports';
import { EventEmitter, Uri } from 'vscode';
import { ExecutionResult } from '../../../../../client/common/process/types';
import { IDisposableRegistry } from '../../../../../client/common/types';
Expand Down Expand Up @@ -92,9 +91,8 @@ suite('Python envs locator - Environments Resolver', () => {
let stubShellExec: sinon.SinonStub;
setup(() => {
sinon.stub(platformApis, 'getOSType').callsFake(() => platformApis.OSType.Windows);
stubShellExec = ImportMock.mockFunction(
externalDependencies,
'shellExecute',
stubShellExec = sinon.stub(externalDependencies, 'shellExecute');
stubShellExec.returns(
new Promise<ExecutionResult<string>>((resolve) => {
resolve({
stdout:
Expand Down Expand Up @@ -243,9 +241,8 @@ suite('Python envs locator - Environments Resolver', () => {
let stubShellExec: sinon.SinonStub;
setup(() => {
sinon.stub(platformApis, 'getOSType').callsFake(() => platformApis.OSType.Windows);
stubShellExec = ImportMock.mockFunction(
externalDependencies,
'shellExecute',
stubShellExec = sinon.stub(externalDependencies, 'shellExecute');
stubShellExec.returns(
new Promise<ExecutionResult<string>>((resolve) => {
resolve({
stdout:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import * as assert from 'assert';
import * as fsapi from 'fs-extra';
import * as path from 'path';
import * as sinon from 'sinon';
import { ImportMock } from 'ts-mock-imports';
import * as platformUtils from '../../../../client/common/utils/platform';
import { PythonReleaseLevel, PythonVersion } from '../../../../client/pythonEnvironments/base/info';
import * as fileUtils from '../../../../client/pythonEnvironments/common/externalDependencies';
Expand All @@ -25,11 +24,11 @@ suite('isVenvEnvironment Tests', () => {
let fileExistsStub: sinon.SinonStub;

setup(() => {
fileExistsStub = ImportMock.mockFunction(fileUtils, 'pathExists');
fileExistsStub = sinon.stub(fileUtils, 'pathExists');
});

teardown(() => {
fileExistsStub.restore();
sinon.restore();
});

test('pyvenv.cfg does not exist', async () => {
Expand Down

0 comments on commit b38ea75

Please sign in to comment.