From ed0803e668dc626c5e632ad1ff71ba85cbb83cd1 Mon Sep 17 00:00:00 2001 From: rebornix Date: Sat, 30 May 2020 18:05:54 -0700 Subject: [PATCH] fix false negative tests --- .../vscode-notebook-tests/src/notebook.test.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/extensions/vscode-notebook-tests/src/notebook.test.ts b/extensions/vscode-notebook-tests/src/notebook.test.ts index 050d22db32f..82c030c684f 100644 --- a/extensions/vscode-notebook-tests/src/notebook.test.ts +++ b/extensions/vscode-notebook-tests/src/notebook.test.ts @@ -8,6 +8,14 @@ import * as assert from 'assert'; import * as vscode from 'vscode'; import { join } from 'path'; +export function timeoutAsync(n: number): Promise { + return new Promise(resolve => { + setTimeout(() => { + resolve(); + }, n); + }); +} + export function once(event: vscode.Event): vscode.Event { return (listener: any, thisArgs = null, disposables?: any) => { // we need this, in case the event fires during the listener call @@ -103,14 +111,14 @@ suite('API tests', () => { await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest'); assert.equal(count, 1); - await vscode.commands.executeCommand('workbench.action.splitEditor'); + await splitEditor(); assert.equal(count, 2); await vscode.commands.executeCommand('workbench.action.closeAllEditors'); assert.equal(count, 0); }); - test('editor editing event', async function () { + test('editor editing event 2', async function () { const resource = vscode.Uri.parse(join(vscode.workspace.rootPath || '', './first.vsctestnb')); await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');