Skip to content
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

Merged
merged 3 commits into from Feb 19, 2021

Conversation

DonJayamanne
Copy link
Contributor

This PR fixes ##116967

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 });
Copy link
Contributor Author

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,
Copy link
Contributor Author

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 () {
Copy link
Member

@rebornix rebornix Feb 18, 2021

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.

Copy link
Member

@jrieken jrieken left a 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)

@jrieken jrieken merged commit fa6c46b into microsoft:main Feb 19, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Apr 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants