Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/test/common/variables/envVarsProvider.multiroot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,10 @@ suite('Multiroot Environment Variables Provider', () => {
expect(newVars).to.not.to.have.property('PYTHONPATH', '../workspace5', 'PYTHONPATH value is invalid');
});

// Check https://github.com/Microsoft/vscode-python/issues/4067
test('Custom variables will be refreshed when .env file is created, modified and deleted', async function () {
// tslint:disable-next-line:no-invalid-this
return this.skip();
// tslint:disable-next-line:no-invalid-this
this.timeout(20000);
const env3 = path.join(workspace4Path.fsPath, '.env3');
Expand Down
2 changes: 1 addition & 1 deletion src/test/linters/lint.args.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ suite('Linting - Arguments', () => {
document.setup(d => d.uri).returns(() => fileUri);

let invoked = false;
(linter as any).run = (args, doc, token) => {
(linter as any).run = (args: any[], doc: any, token: any) => {
expect(args[args.length - 1]).to.equal(fileUri.fsPath);
invoked = true;
return Promise.resolve([]);
Expand Down
2 changes: 1 addition & 1 deletion src/test/linters/lint.multiroot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ suite('Multiroot Linting', () => {
const errorMessage = mustHaveErrors ? 'No errors returned by linter' : 'Errors returned by linter';
assert.equal(messages.length > 0, mustHaveErrors, errorMessage);
}
async function enableDisableSetting(workspaceFolder, configTarget: ConfigurationTarget, setting: string, value: boolean): Promise<void> {
async function enableDisableSetting(workspaceFolder: string, configTarget: ConfigurationTarget, setting: string, value: boolean): Promise<void> {
const config = ioc.serviceContainer.get<IConfigurationService>(IConfigurationService);
await config.updateSetting(setting, value, Uri.file(workspaceFolder), configTarget);
}
Expand Down
11 changes: 7 additions & 4 deletions src/test/linters/lint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ suite('Linting Settings', () => {
let linterManager: ILinterManager;
let configService: IConfigurationService;

suiteSetup(async function() {
suiteSetup(async function () {
// These tests are still consistently failing during teardown.
// See gh-4326.
// tslint:disable-next-line:no-invalid-this
Expand Down Expand Up @@ -96,14 +96,17 @@ suite('Linting Settings', () => {
const settings = configService.getSettings();
await resetSettings();

assert.equal(settings.linting[`${Product[product]}Enabled`], false, 'mismatch');
// tslint:disable-next-line:no-any
assert.equal((settings.linting as any)[`${Product[product]}Enabled`], false, 'mismatch');

await linterManager.setActiveLintersAsync([product]);

assert.equal(settings.linting[`${Product[product]}Enabled`], true, 'mismatch');
// tslint:disable-next-line:no-any
assert.equal((settings.linting as any)[`${Product[product]}Enabled`], true, 'mismatch');
linterManager.getAllLinterInfos().forEach(async (x) => {
if (x.product !== product) {
assert.equal(settings.linting[x.enabledSettingName], false, 'mismatch');
// tslint:disable-next-line:no-any
assert.equal((settings.linting as any)[x.enabledSettingName], false, 'mismatch');
}
});
});
Expand Down
21 changes: 13 additions & 8 deletions src/test/linters/lint.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ suite('Linting Scenarios', () => {
}
for (const product of LINTERID_BY_PRODUCT.keys()) {
for (const enabled of [false, true]) {
test(`${enabled ? 'Enable' : 'Disable'} ${getProductName(product)} and run linter`, async function() {
test(`${enabled ? 'Enable' : 'Disable'} ${getProductName(product)} and run linter`, async function () {
// tslint:disable-next-line:no-suspicious-comment
// TODO: Add coverage for these linters.
if ([Product.bandit, Product.mypy, Product.pylama, Product.prospector].some(p => p === product)) {
Expand Down Expand Up @@ -315,15 +315,15 @@ suite('Linting Scenarios', () => {
}
}
for (const product of LINTERID_BY_PRODUCT.keys()) {
test(`Check ${getProductName(product)} messages`, async function() {
test(`Check ${getProductName(product)} messages`, async function () {
// tslint:disable-next-line:no-suspicious-comment
// TODO: Add coverage for these linters.
if ([Product.bandit, Product.mypy, Product.pylama, Product.prospector].some(p => p === product)) {
// tslint:disable-next-line:no-invalid-this
this.skip();
}

const fixture = new TestFixture();
const fixture = new TestFixture();
await testLinterMessages(fixture, product);
});
}
Expand Down Expand Up @@ -353,20 +353,25 @@ suite('Linting Scenarios', () => {
});

const PRODUCTS = Object.keys(Product)
.filter(key => !isNaN(Number(Product[key])))
.map(key => Product[key]);
// tslint:disable-next-line:no-any
.filter(key => !isNaN(Number(Product[key as any])))
// tslint:disable-next-line:no-any
.map(key => Product[key as any]);

// tslint:disable-next-line:max-func-body-length
suite('Linting Products', () => {
const prodService = new ProductService();

test('All linting products are represented by linters', async () => {
for (const product of PRODUCTS) {
if (prodService.getProductType(product) !== ProductType.Linter) {
// tslint:disable-next-line:no-any
if (prodService.getProductType(product as any) !== ProductType.Linter) {
continue;
}
const found = LINTERID_BY_PRODUCT.get(product);
assert.notEqual(found, undefined, `did find linter ${Product[product]}`);
// tslint:disable-next-line:no-any
const found = LINTERID_BY_PRODUCT.get(product as any);
// tslint:disable-next-line:no-any
assert.notEqual(found, undefined, `did find linter ${Product[product as any]}`);
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ suite('Method Extraction', () => {
refactorTargetFile = path.join(refactorTargetFileDir, `refactor${new Date().getTime()}.py`);
fs.copySync(refactorSourceFile, refactorTargetFile, { overwrite: true });
await initializeTest();
(commands as any).executeCommand = (cmd) => Promise.resolve();
(commands as any).executeCommand = (cmd: any) => Promise.resolve();
});
teardown(async () => {
commands.executeCommand = oldExecuteCommand;
Expand Down
2 changes: 1 addition & 1 deletion src/test/refactor/extension.refactor.extract.var.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ suite('Variable Extraction', () => {
refactorTargetFile = path.join(refactorTargetFileDir, `refactor${new Date().getTime()}.py`);
fs.copySync(refactorSourceFile, refactorTargetFile, { overwrite: true });
await initializeTest();
(<any>commands).executeCommand = (cmd) => Promise.resolve();
(<any>commands).executeCommand = (cmd: any) => Promise.resolve();
});
teardown(async () => {
commands.executeCommand = oldExecuteCommand;
Expand Down
6 changes: 3 additions & 3 deletions src/test/testRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type TestCallback = (error?: Error, failures?: number) => void;
// Since we are not running in a tty environment, we just implement the method statically.
const tty = require('tty');
if (!tty.getWindowSize) {
tty.getWindowSize = function(): number[] {
tty.getWindowSize = function (): number[] {
return [80, 75];
};
}
Expand Down Expand Up @@ -240,7 +240,7 @@ class CoverageRunner {
// When instrumenting the code, istanbul will give each FunctionDeclaration a value of 1 in coverState.s,
// presumably to compensate for function hoisting. We need to reset this, as the function was not hoisted,
// as it was never loaded.
Object.keys(this.instrumenter.coverState.s).forEach(key => (this.instrumenter.coverState.s[key] = 0));
Object.keys(this.instrumenter.coverState.s).forEach(key => ((this.instrumenter.coverState.s as any)[key] = 0));

coverage[file] = this.instrumenter.coverState;
});
Expand All @@ -252,7 +252,7 @@ class CoverageRunner {
fs.writeFileSync(coverageFile, JSON.stringify(coverage), 'utf8');

const remappedCollector: istanbul.Collector = remapIstanbul.remap(coverage, {
warn: warning => {
warn: (warning: any) => {
// We expect some warnings as any JS file without a typescript mapping will cause this.
// By default, we'll skip printing these to the console as it clutters it up.
if (this.options.verbose) {
Expand Down
4 changes: 2 additions & 2 deletions src/test/unittests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ const Module = require('module');
// tslint:disable-next-line:no-function-expression
(function () {
const origRequire = Module.prototype.require;
const _require = (context, filepath) => {
const _require = (context: any, filepath: any) => {
return origRequire.call(context, filepath);
};
Module.prototype.require = function (filepath) {
Module.prototype.require = function (filepath: any) {
if (filepath.endsWith('.css') || filepath.endsWith('.svg')) {
return '';
}
Expand Down
Loading