|
6 | 6 | import * as assert from 'assert';
|
7 | 7 | import 'mocha';
|
8 | 8 | import * as vscode from 'vscode';
|
| 9 | +import { assertNoRpc, closeAllEditors, createRandomFile } from '../utils'; |
| 10 | + |
| 11 | +const ipynbContent = JSON.stringify({ |
| 12 | + "cells": [ |
| 13 | + { |
| 14 | + "cell_type": "markdown", |
| 15 | + "source": ["## Header"], |
| 16 | + "metadata": {} |
| 17 | + }, |
| 18 | + { |
| 19 | + "cell_type": "code", |
| 20 | + "execution_count": 2, |
| 21 | + "source": ["print('hello 1')\n", "print('hello 2')"], |
| 22 | + "outputs": [ |
| 23 | + { |
| 24 | + "output_type": "stream", |
| 25 | + "name": "stdout", |
| 26 | + "text": ["hello 1\n", "hello 2\n"] |
| 27 | + } |
| 28 | + ], |
| 29 | + "metadata": {} |
| 30 | + } |
| 31 | + ] |
| 32 | +}); |
| 33 | + |
| 34 | +suite('ipynb NotebookSerializer', function () { |
| 35 | + teardown(async function () { |
| 36 | + assertNoRpc(); |
| 37 | + await closeAllEditors(); |
| 38 | + }); |
9 | 39 |
|
10 |
| -(vscode.env.uiKind === vscode.UIKind.Web ? suite.skip : suite)('ipynb NotebookSerializer', function () { |
11 | 40 | test('Can open an ipynb notebook', async () => {
|
12 |
| - assert.ok(vscode.workspace.workspaceFolders); |
13 |
| - const workspace = vscode.workspace.workspaceFolders[0]; |
14 |
| - const uri = vscode.Uri.joinPath(workspace.uri, 'test.ipynb'); |
15 |
| - const notebook = await vscode.workspace.openNotebookDocument(uri); |
| 41 | + const file = await createRandomFile(ipynbContent, undefined, '.ipynb'); |
| 42 | + const notebook = await vscode.workspace.openNotebookDocument(file); |
16 | 43 | await vscode.window.showNotebookDocument(notebook);
|
17 | 44 |
|
18 | 45 | const notebookEditor = vscode.window.activeNotebookEditor;
|
|
0 commit comments