Skip to content

Commit

Permalink
notebook tests - run verbose (#165149) (#167212)
Browse files Browse the repository at this point in the history
* notebook tests - run verbose (#165149)

* bumpb

* 💄
  • Loading branch information
bpasero committed Nov 26, 2022
1 parent fd8c903 commit ac084d7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as assert from 'assert';
import * as vscode from 'vscode';
import * as utils from '../utils';

(vscode.env.uiKind === vscode.UIKind.Web ? suite.skip : suite.skip)('Notebook Editor', function () {
(vscode.env.uiKind === vscode.UIKind.Web ? suite.skip : suite)('Notebook Editor', function () {

const contentSerializer = new class implements vscode.NotebookSerializer {
deserializeNotebook() {
Expand Down Expand Up @@ -66,14 +66,14 @@ import * as utils from '../utils';
});

// #138683
test('Opening a notebook should fire activeNotebook event changed only once', async function () {
test('Opening a notebook should fire activeNotebook event changed only once', utils.withVerboseLogs(async function () {
const openedEditor = onDidOpenNotebookEditor();
const resource = await utils.createRandomFile(undefined, undefined, '.nbdtest');
const document = await vscode.workspace.openNotebookDocument(resource);
const editor = await vscode.window.showNotebookDocument(document);
assert.ok(await openedEditor);
assert.strictEqual(editor.notebook.uri.toString(), resource.toString());
});
}));

test('Active/Visible Editor', async function () {
const firstEditorOpen = onDidOpenNotebookEditor();
Expand Down
12 changes: 10 additions & 2 deletions extensions/vscode-api-tests/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ export function delay(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms));
}

export function withLogDisabled(runnable: () => Promise<any>): () => Promise<void> {
function withLogLevel(level: string, runnable: () => Promise<any>): () => Promise<void> {
return async (): Promise<void> => {
const logLevel = await vscode.commands.executeCommand('_extensionTests.getLogLevel');
await vscode.commands.executeCommand('_extensionTests.setLogLevel', 'off');
await vscode.commands.executeCommand('_extensionTests.setLogLevel', level);

try {
await runnable();
Expand All @@ -79,6 +79,14 @@ export function withLogDisabled(runnable: () => Promise<any>): () => Promise<voi
};
}

export function withLogDisabled(runnable: () => Promise<any>): () => Promise<void> {
return withLogLevel('off', runnable);
}

export function withVerboseLogs(runnable: () => Promise<any>): () => Promise<void> {
return withLogLevel('trace', runnable);
}

export function assertNoRpc() {
assertNoRpcFromEntry([vscode, 'vscode']);
}
Expand Down

0 comments on commit ac084d7

Please sign in to comment.