Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix all typescript errors when compiled in strict mode #3 #4419

Merged
merged 7 commits into from
Mar 1, 2019
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
34 changes: 17 additions & 17 deletions src/client/providers/symbolProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,23 +147,23 @@ export class JediSymbolProvider implements DocumentSymbolProvider {

// This does not appear to be used anywhere currently...
// tslint:disable-next-line:no-unused-variable
private provideDocumentSymbolsUnthrottled(document: TextDocument, token: CancellationToken): Thenable<SymbolInformation[]> {
const filename = document.fileName;

const cmd: proxy.ICommand<proxy.ISymbolResult> = {
command: proxy.CommandType.Symbols,
fileName: filename,
columnIndex: 0,
lineIndex: 0
};

if (document.isDirty) {
cmd.source = document.getText();
}

return this.jediFactory.getJediProxyHandler<proxy.ISymbolResult>(document.uri).sendCommandNonCancellableCommand(cmd, token)
.then(data => this.parseData(document, data));
}
// private provideDocumentSymbolsUnthrottled(document: TextDocument, token: CancellationToken): Thenable<SymbolInformation[]> {
// const filename = document.fileName;

// const cmd: proxy.ICommand<proxy.ISymbolResult> = {
// command: proxy.CommandType.Symbols,
// fileName: filename,
// columnIndex: 0,
// lineIndex: 0
// };

// if (document.isDirty) {
// cmd.source = document.getText();
// }

// return this.jediFactory.getJediProxyHandler<proxy.ISymbolResult>(document.uri).sendCommandNonCancellableCommand(cmd, token)
// .then(data => this.parseData(document, data));
// }

private parseData(document: TextDocument, data?: proxy.ISymbolResult): SymbolInformation[] {
if (data) {
Expand Down
2 changes: 1 addition & 1 deletion src/client/unittests/common/xUnitParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function updateResultsFromXmlLogFile(tests: Tests, outputXmlFile: string,
}
// tslint:disable-next-line:no-require-imports
const xml2js = require('xml2js');
xml2js.parseString(data, (error, parserResult) => {
xml2js.parseString(data, (error: Error, parserResult: { testsuite: TestSuiteResult }) => {
if (error) {
return reject(error);
}
Expand Down
2 changes: 1 addition & 1 deletion src/client/unittests/display/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class TestResultDisplay implements ITestResultDisplay {
private statusBar: StatusBarItem;
private discoverCounter = 0;
private ticker = ['|', '/', '-', '|', '/', '-', '\\'];
private progressTimeout;
private progressTimeout: NodeJS.Timer | null = null;
karrtikr marked this conversation as resolved.
Show resolved Hide resolved
private _enabled: boolean = false;
private progressPrefix!: string;
private readonly didChange = new EventEmitter<void>();
Expand Down
3 changes: 2 additions & 1 deletion src/client/unittests/explorer/commandHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import { ITestDataItemResource, TestDataItem } from '../types';
const testNavigationCommandMapping = {
[TestType.testFile]: Commands.navigateToTestFile,
[TestType.testFunction]: Commands.navigateToTestFunction,
[TestType.testSuite]: Commands.navigateToTestSuite
[TestType.testSuite]: Commands.navigateToTestSuite,
[TestType.testFolder]: undefined
};

@injectable()
Expand Down
7 changes: 4 additions & 3 deletions src/client/unittests/pytest/services/testMessageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class TestMessageService implements ITestMessageService {
* @param testResults Details about all known tests.
*/
public async getFilteredTestMessages(rootDirectory: string, testResults: Tests): Promise<IPythonUnitTestMessage[]> {
const testFuncs: FlattenedTestFunction[] = testResults.testFunctions.reduce<FlattenedTestFunction[]>((filtered, test) => {
const testFuncs = testResults.testFunctions.reduce<FlattenedTestFunction[]>((filtered, test) => {
if (test.testFunction.passed !== undefined || test.testFunction.status === TestStatus.Skipped) {
filtered.push(test);
}
Expand Down Expand Up @@ -107,14 +107,15 @@ export class TestMessageService implements ITestMessageService {
testSourceFilePath = path.isAbsolute(testSourceFilePath) ? testSourceFilePath : path.resolve(rootDirectory, testSourceFilePath);
const testSourceFileUri = Uri.file(testSourceFilePath);
const testSourceFile = await workspace.openTextDocument(testSourceFileUri);
let testDefLine: TextLine | undefined;
let testDefLine: TextLine | null = null;
let lineNum = testFunction.testFunction.line!;
let lineText: string = '';
let trimmedLineText: string = '';
const testDefPrefix = 'def ';
const testAsyncDefPrefix = 'async def ';
let prefix = '';
while (testDefLine === undefined) {

while (testDefLine === null) {
karrtikr marked this conversation as resolved.
Show resolved Hide resolved
const possibleTestDefLine = testSourceFile.lineAt(lineNum);
lineText = possibleTestDefLine.text;
trimmedLineText = lineText.trimLeft()!;
Expand Down
4 changes: 2 additions & 2 deletions src/client/unittests/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ export interface IPythonUnitTestMessage {
code: string | undefined;
message?: string;
severity: PythonUnitTestMessageSeverity;
provider: string;
provider: string | undefined;
traceback?: string;
testTime: number;
status: TestStatus;
status?: TestStatus;
locationStack?: ILocationStackFrameDetails[];
testFilePath: string;
}
Expand Down
8 changes: 6 additions & 2 deletions src/test/debugger/misc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,19 @@ suite(`Standard Debugging - Misc tests: ${debuggerType}`, () => {
return options;
}

test('Should run program to the end', async () => {
// Check https://github.com/Microsoft/vscode-python/issues/4067
test('Should run program to the end', async function () {
return this.skip();
await Promise.all([
debugClient.configurationSequence(),
debugClient.launch(buildLaunchArgs('simplePrint.py', false)),
debugClient.waitForEvent('initialized'),
debugClient.waitForEvent('terminated')
]);
});
test('test stderr output for Python', async () => {
// Check https://github.com/Microsoft/vscode-python/issues/4067
test('test stderr output for Python', async function () {
return this.skip();
await Promise.all([
debugClient.configurationSequence(),
debugClient.launch(buildLaunchArgs('stdErrOutput.py', false)),
Expand Down