New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cell output metadata to be added to Notebook Model #116968
Conversation
const resource = await createRandomFile('', undefined, '.vsctestnb'); | ||
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest'); | ||
assert.strictEqual(vscode.window.activeNotebookEditor !== undefined, true, 'notebook first'); | ||
assert.strictEqual(vscode.window.activeNotebookEditor!.selection?.document.getText(), 'test'); | ||
assert.strictEqual(vscode.window.activeNotebookEditor!.selection?.language, 'typescript'); | ||
|
||
const secondCell = vscode.window.activeNotebookEditor!.document.cells[1]; | ||
assert.strictEqual(secondCell!.outputs.length, 1); | ||
assert.deepStrictEqual(secondCell!.outputs[0].metadata, { testOutputMetadata: true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was failing.
@@ -1466,7 +1466,9 @@ export namespace NotebookCellData { | |||
source: data.source, | |||
metadata: data.metadata, | |||
outputs: data.outputs.map(output => ({ | |||
outputId: output.id, outputs: (output.outputs || []).map(op => ({ | |||
outputId: output.id, | |||
metadata: output.metadata, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what was missing
@@ -65,7 +65,7 @@ async function withEvent<T>(event: vscode.Event<T>, callback: (e: Promise<T>) => | |||
await callback(e); | |||
} | |||
|
|||
suite('Notebook API tests', function () { | |||
suite.only('Notebook API tests', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure .only
is not checked in when merging the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Change look OK but there is some uglyness in needing to change so many tests. We have plans to write them more pretty so expect some further changes soon. Also, for the future, esp wrt notebook document suff, you could add your tests into notebook.document.test.ts
(which tries to be a little more modern)
This PR fixes ##116967