Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
bd47ac84
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bd47ac84
编写于
2月 08, 2021
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
auto save ...
上级
779938d5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
33 addition
and
33 deletion
+33
-33
extensions/vscode-notebook-tests/src/notebook.test.ts
extensions/vscode-notebook-tests/src/notebook.test.ts
+33
-33
未找到文件。
extensions/vscode-notebook-tests/src/notebook.test.ts
浏览文件 @
bd47ac84
...
...
@@ -297,7 +297,7 @@ suite('Notebook API tests', () => {
document
:
vscode
.
window
.
activeNotebookEditor
!
.
document
,
cells
:
[
vscode
.
window
.
activeNotebookEditor
!
.
document
.
cells
[
0
]]
});
assert
.
strictEqual
(
cellOutputsAddedRet
.
cells
[
0
].
outputs
2
.
length
,
1
);
assert
.
strictEqual
(
cellOutputsAddedRet
.
cells
[
0
].
outputs
.
length
,
1
);
const
cellOutputClear
=
getEventOncePromise
<
vscode
.
NotebookCellOutputsChangeEvent
>
(
vscode
.
notebook
.
onDidChangeCellOutputs
);
await
vscode
.
commands
.
executeCommand
(
'
notebook.cell.clearOutputs
'
);
...
...
@@ -306,7 +306,7 @@ suite('Notebook API tests', () => {
document
:
vscode
.
window
.
activeNotebookEditor
!
.
document
,
cells
:
[
vscode
.
window
.
activeNotebookEditor
!
.
document
.
cells
[
0
]]
});
assert
.
strictEqual
(
cellOutputsAddedRet
.
cells
[
0
].
outputs
2
.
length
,
0
);
assert
.
strictEqual
(
cellOutputsAddedRet
.
cells
[
0
].
outputs
.
length
,
0
);
// const cellChangeLanguage = getEventOncePromise<vscode.NotebookCellLanguageChangeEvent>(vscode.notebook.onDidChangeCellLanguage);
// await vscode.commands.executeCommand('notebook.cell.changeToMarkdown');
...
...
@@ -447,10 +447,10 @@ suite('Notebook API tests', () => {
const
document
=
vscode
.
window
.
activeNotebookEditor
?.
document
!
;
assert
.
strictEqual
(
document
.
isDirty
,
true
);
assert
.
strictEqual
(
document
.
cells
.
length
,
1
);
assert
.
strictEqual
(
document
.
cells
[
0
].
outputs
2
.
length
,
1
);
assert
.
strictEqual
(
document
.
cells
[
0
].
outputs
.
length
,
1
);
// consuming is OLD api (for now)
const
[
output
]
=
document
.
cells
[
0
].
outputs
2
;
const
[
output
]
=
document
.
cells
[
0
].
outputs
;
assert
.
strictEqual
(
output
.
outputs
.
length
,
2
);
assert
.
strictEqual
(
output
.
outputs
[
0
].
mime
,
'
application/foo
'
);
...
...
@@ -475,10 +475,10 @@ suite('Notebook API tests', () => {
const
document
=
vscode
.
window
.
activeNotebookEditor
?.
document
!
;
assert
.
strictEqual
(
document
.
isDirty
,
true
);
assert
.
strictEqual
(
document
.
cells
.
length
,
1
);
assert
.
strictEqual
(
document
.
cells
[
0
].
outputs
2
.
length
,
1
);
assert
.
strictEqual
(
document
.
cells
[
0
].
outputs
2
[
0
].
outputs
.
length
,
1
);
assert
.
strictEqual
(
document
.
cells
[
0
].
outputs
2
[
0
].
outputs
[
0
].
mime
,
'
foo
'
);
assert
.
strictEqual
(
document
.
cells
[
0
].
outputs
2
[
0
].
outputs
[
0
].
value
,
'
bar
'
);
assert
.
strictEqual
(
document
.
cells
[
0
].
outputs
.
length
,
1
);
assert
.
strictEqual
(
document
.
cells
[
0
].
outputs
[
0
].
outputs
.
length
,
1
);
assert
.
strictEqual
(
document
.
cells
[
0
].
outputs
[
0
].
outputs
[
0
].
mime
,
'
foo
'
);
assert
.
strictEqual
(
document
.
cells
[
0
].
outputs
[
0
].
outputs
[
0
].
value
,
'
bar
'
);
await
saveAllFilesAndCloseAll
(
undefined
);
});
...
...
@@ -500,10 +500,10 @@ suite('Notebook API tests', () => {
assert
.
strictEqual
(
value
.
document
.
isDirty
,
true
);
assert
.
strictEqual
(
value
.
cells
.
length
,
1
);
assert
.
strictEqual
(
value
.
document
.
cells
.
length
,
1
);
assert
.
strictEqual
(
value
.
document
.
cells
[
0
].
outputs
2
.
length
,
1
);
assert
.
strictEqual
(
value
.
document
.
cells
[
0
].
outputs
2
[
0
].
outputs
.
length
,
1
);
assert
.
strictEqual
(
value
.
document
.
cells
[
0
].
outputs
2
[
0
].
outputs
[
0
].
mime
,
'
foo
'
);
assert
.
strictEqual
(
value
.
document
.
cells
[
0
].
outputs
2
[
0
].
outputs
[
0
].
value
,
'
bar
'
);
assert
.
strictEqual
(
value
.
document
.
cells
[
0
].
outputs
.
length
,
1
);
assert
.
strictEqual
(
value
.
document
.
cells
[
0
].
outputs
[
0
].
outputs
.
length
,
1
);
assert
.
strictEqual
(
value
.
document
.
cells
[
0
].
outputs
[
0
].
outputs
[
0
].
mime
,
'
foo
'
);
assert
.
strictEqual
(
value
.
document
.
cells
[
0
].
outputs
[
0
].
outputs
[
0
].
value
,
'
bar
'
);
await
saveAllFilesAndCloseAll
(
undefined
);
});
...
...
@@ -916,21 +916,21 @@ suite('notebook workflow', () => {
await
vscode
.
commands
.
executeCommand
(
'
notebook.focusTop
'
);
const
cell
=
editor
.
document
.
cells
[
0
];
assert
.
strictEqual
(
cell
.
outputs
2
.
length
,
0
);
assert
.
strictEqual
(
cell
.
outputs
.
length
,
0
);
let
metadataChangeEvent
=
getEventOncePromise
<
vscode
.
NotebookCellMetadataChangeEvent
>
(
vscode
.
notebook
.
onDidChangeCellMetadata
);
await
updateCellMetadata
(
resource
,
cell
,
{
...
cell
.
metadata
,
runnable
:
false
});
await
metadataChangeEvent
;
await
vscode
.
commands
.
executeCommand
(
'
notebook.cell.execute
'
);
assert
.
strictEqual
(
cell
.
outputs
2
.
length
,
0
,
'
should not execute
'
);
// not runnable, didn't work
assert
.
strictEqual
(
cell
.
outputs
.
length
,
0
,
'
should not execute
'
);
// not runnable, didn't work
metadataChangeEvent
=
getEventOncePromise
<
vscode
.
NotebookCellMetadataChangeEvent
>
(
vscode
.
notebook
.
onDidChangeCellMetadata
);
await
updateCellMetadata
(
resource
,
cell
,
{
...
cell
.
metadata
,
runnable
:
true
});
await
metadataChangeEvent
;
await
vscode
.
commands
.
executeCommand
(
'
notebook.cell.execute
'
);
assert
.
strictEqual
(
cell
.
outputs
2
.
length
,
1
,
'
should execute
'
);
// runnable, it worked
assert
.
strictEqual
(
cell
.
outputs
.
length
,
1
,
'
should execute
'
);
// runnable, it worked
await
vscode
.
commands
.
executeCommand
(
'
workbench.action.files.save
'
);
await
vscode
.
commands
.
executeCommand
(
'
workbench.action.closeActiveEditor
'
);
...
...
@@ -944,7 +944,7 @@ suite('notebook workflow', () => {
const
editor
=
vscode
.
window
.
activeNotebookEditor
!
;
const
cell
=
editor
.
document
.
cells
[
0
];
assert
.
strictEqual
(
cell
.
outputs
2
.
length
,
0
);
assert
.
strictEqual
(
cell
.
outputs
.
length
,
0
);
await
withEvent
(
vscode
.
notebook
.
onDidChangeNotebookDocumentMetadata
,
async
event
=>
{
updateNotebookMetadata
(
editor
.
document
.
uri
,
{
...
editor
.
document
.
metadata
,
runnable
:
false
});
...
...
@@ -952,7 +952,7 @@ suite('notebook workflow', () => {
});
await
vscode
.
commands
.
executeCommand
(
'
notebook.execute
'
);
assert
.
strictEqual
(
cell
.
outputs
2
.
length
,
0
,
'
should not execute
'
);
// not runnable, didn't work
assert
.
strictEqual
(
cell
.
outputs
.
length
,
0
,
'
should not execute
'
);
// not runnable, didn't work
await
withEvent
(
vscode
.
notebook
.
onDidChangeNotebookDocumentMetadata
,
async
event
=>
{
updateNotebookMetadata
(
editor
.
document
.
uri
,
{
...
editor
.
document
.
metadata
,
runnable
:
true
});
...
...
@@ -962,7 +962,7 @@ suite('notebook workflow', () => {
await
withEvent
<
vscode
.
NotebookCellOutputsChangeEvent
>
(
vscode
.
notebook
.
onDidChangeCellOutputs
,
async
(
event
)
=>
{
await
vscode
.
commands
.
executeCommand
(
'
notebook.execute
'
);
await
event
;
assert
.
strictEqual
(
cell
.
outputs
2
.
length
,
1
,
'
should execute
'
);
// runnable, it worked
assert
.
strictEqual
(
cell
.
outputs
.
length
,
1
,
'
should execute
'
);
// runnable, it worked
});
await
vscode
.
commands
.
executeCommand
(
'
workbench.action.files.save
'
);
...
...
@@ -980,7 +980,7 @@ suite('notebook workflow', () => {
const
cell
=
editor
.
document
.
cells
[
0
];
await
vscode
.
commands
.
executeCommand
(
'
notebook.execute
'
);
assert
.
strictEqual
(
cell
.
outputs
2
.
length
,
0
,
'
should not execute
'
);
// not runnable, didn't work
assert
.
strictEqual
(
cell
.
outputs
.
length
,
0
,
'
should not execute
'
);
// not runnable, didn't work
await
vscode
.
commands
.
executeCommand
(
'
workbench.action.files.save
'
);
await
vscode
.
commands
.
executeCommand
(
'
workbench.action.closeActiveEditor
'
);
...
...
@@ -1002,13 +1002,13 @@ suite('notebook workflow', () => {
await
withEvent
(
vscode
.
notebook
.
onDidChangeCellOutputs
,
async
(
event
)
=>
{
await
vscode
.
commands
.
executeCommand
(
'
notebook.execute
'
);
await
event
;
assert
.
strictEqual
(
cell
.
outputs
2
.
length
,
1
,
'
should execute
'
);
// runnable, it worked
assert
.
strictEqual
(
cell
.
outputs
.
length
,
1
,
'
should execute
'
);
// runnable, it worked
});
await
withEvent
(
vscode
.
notebook
.
onDidChangeCellOutputs
,
async
event
=>
{
await
vscode
.
commands
.
executeCommand
(
'
notebook.cell.clearOutputs
'
);
await
event
;
assert
.
strictEqual
(
cell
.
outputs
2
.
length
,
0
,
'
should clear
'
);
assert
.
strictEqual
(
cell
.
outputs
.
length
,
0
,
'
should clear
'
);
});
const
secondResource
=
await
createRandomFile
(
''
,
undefined
,
'
second
'
,
'
.vsctestnb
'
);
...
...
@@ -1017,7 +1017,7 @@ suite('notebook workflow', () => {
await
withEvent
<
vscode
.
NotebookCellOutputsChangeEvent
>
(
vscode
.
notebook
.
onDidChangeCellOutputs
,
async
(
event
)
=>
{
await
vscode
.
commands
.
executeCommand
(
'
notebook.cell.execute
'
,
{
start
:
0
,
end
:
1
},
resource
);
await
event
;
assert
.
strictEqual
(
cell
.
outputs
2
.
length
,
1
,
'
should execute
'
);
// runnable, it worked
assert
.
strictEqual
(
cell
.
outputs
.
length
,
1
,
'
should execute
'
);
// runnable, it worked
assert
.
strictEqual
(
vscode
.
window
.
activeNotebookEditor
?.
document
.
uri
.
fsPath
,
secondResource
.
fsPath
);
});
...
...
@@ -1043,13 +1043,13 @@ suite('notebook workflow', () => {
await
withEvent
<
vscode
.
NotebookCellOutputsChangeEvent
>
(
vscode
.
notebook
.
onDidChangeCellOutputs
,
async
(
event
)
=>
{
await
vscode
.
commands
.
executeCommand
(
'
notebook.execute
'
);
await
event
;
assert
.
strictEqual
(
cell
.
outputs
2
.
length
,
1
,
'
should execute
'
);
// runnable, it worked
assert
.
strictEqual
(
cell
.
outputs
.
length
,
1
,
'
should execute
'
);
// runnable, it worked
});
const
clearChangeEvent
=
getEventOncePromise
<
vscode
.
NotebookCellOutputsChangeEvent
>
(
vscode
.
notebook
.
onDidChangeCellOutputs
);
await
vscode
.
commands
.
executeCommand
(
'
notebook.cell.clearOutputs
'
);
await
clearChangeEvent
;
assert
.
strictEqual
(
cell
.
outputs
2
.
length
,
0
,
'
should clear
'
);
assert
.
strictEqual
(
cell
.
outputs
.
length
,
0
,
'
should clear
'
);
const
secondResource
=
await
createRandomFile
(
''
,
undefined
,
'
second
'
,
'
.vsctestnb
'
);
await
vscode
.
commands
.
executeCommand
(
'
vscode.openWith
'
,
secondResource
,
'
notebookCoreTest
'
);
...
...
@@ -1057,7 +1057,7 @@ suite('notebook workflow', () => {
await
withEvent
<
vscode
.
NotebookCellOutputsChangeEvent
>
(
vscode
.
notebook
.
onDidChangeCellOutputs
,
async
(
event
)
=>
{
await
vscode
.
commands
.
executeCommand
(
'
notebook.execute
'
,
resource
);
await
event
;
assert
.
strictEqual
(
cell
.
outputs
2
.
length
,
1
,
'
should execute
'
);
// runnable, it worked
assert
.
strictEqual
(
cell
.
outputs
.
length
,
1
,
'
should execute
'
);
// runnable, it worked
assert
.
strictEqual
(
vscode
.
window
.
activeNotebookEditor
?.
document
.
uri
.
fsPath
,
secondResource
.
fsPath
);
});
...
...
@@ -1080,19 +1080,19 @@ suite('notebook workflow', () => {
await
metadataChangeEvent
;
await
vscode
.
commands
.
executeCommand
(
'
notebook.cell.execute
'
);
assert
.
strictEqual
(
cell
.
outputs
2
.
length
,
1
,
'
should execute
'
);
// runnable, it worked
assert
.
strictEqual
(
cell
.
outputs
2
[
0
].
outputs
.
length
,
1
);
assert
.
strictEqual
(
cell
.
outputs
2
[
0
].
outputs
[
0
].
mime
,
'
text/plain
'
);
assert
.
deepStrictEqual
(
cell
.
outputs
2
[
0
].
outputs
[
0
].
value
,
[
assert
.
strictEqual
(
cell
.
outputs
.
length
,
1
,
'
should execute
'
);
// runnable, it worked
assert
.
strictEqual
(
cell
.
outputs
[
0
].
outputs
.
length
,
1
);
assert
.
strictEqual
(
cell
.
outputs
[
0
].
outputs
[
0
].
mime
,
'
text/plain
'
);
assert
.
deepStrictEqual
(
cell
.
outputs
[
0
].
outputs
[
0
].
value
,
[
'
my output
'
]);
await
vscode
.
commands
.
executeCommand
(
'
notebook.selectKernel
'
,
{
extension
:
'
vscode.vscode-notebook-tests
'
,
id
:
'
secondaryKernel
'
});
await
vscode
.
commands
.
executeCommand
(
'
notebook.cell.execute
'
);
assert
.
strictEqual
(
cell
.
outputs
2
.
length
,
1
,
'
should execute
'
);
// runnable, it worked
assert
.
strictEqual
(
cell
.
outputs
2
[
0
].
outputs
.
length
,
1
);
assert
.
strictEqual
(
cell
.
outputs
2
[
0
].
outputs
[
0
].
mime
,
'
text/plain
'
);
assert
.
deepStrictEqual
(
cell
.
outputs
2
[
0
].
outputs
[
0
].
value
,
[
assert
.
strictEqual
(
cell
.
outputs
.
length
,
1
,
'
should execute
'
);
// runnable, it worked
assert
.
strictEqual
(
cell
.
outputs
[
0
].
outputs
.
length
,
1
);
assert
.
strictEqual
(
cell
.
outputs
[
0
].
outputs
[
0
].
mime
,
'
text/plain
'
);
assert
.
deepStrictEqual
(
cell
.
outputs
[
0
].
outputs
[
0
].
value
,
[
'
my second output
'
]);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录