Skip to content

Commit ed0803e

Browse files
committed
fix false negative tests
1 parent b1c870f commit ed0803e

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

extensions/vscode-notebook-tests/src/notebook.test.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ import * as assert from 'assert';
88
import * as vscode from 'vscode';
99
import { join } from 'path';
1010

11+
export function timeoutAsync(n: number): Promise<void> {
12+
return new Promise(resolve => {
13+
setTimeout(() => {
14+
resolve();
15+
}, n);
16+
});
17+
}
18+
1119
export function once<T>(event: vscode.Event<T>): vscode.Event<T> {
1220
return (listener: any, thisArgs = null, disposables?: any) => {
1321
// we need this, in case the event fires during the listener call
@@ -103,14 +111,14 @@ suite('API tests', () => {
103111
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
104112
assert.equal(count, 1);
105113

106-
await vscode.commands.executeCommand('workbench.action.splitEditor');
114+
await splitEditor();
107115
assert.equal(count, 2);
108116

109117
await vscode.commands.executeCommand('workbench.action.closeAllEditors');
110118
assert.equal(count, 0);
111119
});
112120

113-
test('editor editing event', async function () {
121+
test('editor editing event 2', async function () {
114122
const resource = vscode.Uri.parse(join(vscode.workspace.rootPath || '', './first.vsctestnb'));
115123
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
116124

0 commit comments

Comments
 (0)