Skip to content

Commit

Permalink
Merge pull request #464 from Microsoft/fix/tests
Browse files Browse the repository at this point in the history
Fix/tests
  • Loading branch information
MitchellSternke authored Dec 5, 2016
2 parents 233dfca + 6c0c85f commit 7b128fd
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions test/initialization.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ function ensureExtensionIsActive(): Promise<any> {
}

function waitForExtensionToBeActive(resolve): void {
if (!vscode.extensions.getExtension('Microsoft.mssql').isActive) {
if (typeof(vscode.extensions.getExtension('Microsoft.mssql')) === 'undefined' ||
!vscode.extensions.getExtension('Microsoft.mssql').isActive) {
setTimeout(waitForExtensionToBeActive.bind(this, resolve), 50);
} else {
resolve();
Expand All @@ -26,10 +27,11 @@ suite('Initialization Tests', () => {
Telemetry.disable();
});

test('Connection manager is initialized properly', (done) => {
// Trigger extension activation
let uri = vscode.Uri.parse('untitled:test.sql');
vscode.workspace.openTextDocument(uri);
test('Connection manager is initialized properly', function(done): void { // Note: this can't be an arrow function (=>), otherwise this.timeout() breaks
this.timeout(10000); // Service installation usually takes a bit longer than the default 2000ms on a fresh install

// Force the extension to activate by running one of our commands
vscode.commands.executeCommand('extension.connect');

// Wait for the extension to activate
ensureExtensionIsActive().then(() => {
Expand Down

0 comments on commit 7b128fd

Please sign in to comment.