From eb649d0d9317cfa10b07d614d3b4eddc6d6f47ec Mon Sep 17 00:00:00 2001 From: Don Jayamanne Date: Tue, 12 Aug 2025 21:29:19 +1000 Subject: [PATCH] Add some logging to identify flaky notebooks tests (#261200) --- .../notebook.kernel.test.ts | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/notebook.kernel.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/notebook.kernel.test.ts index b232de35ffb..7cc5e40a100 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/notebook.kernel.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/notebook.kernel.test.ts @@ -14,7 +14,9 @@ async function createRandomNotebookFile() { } async function openRandomNotebookDocument() { + console.log('Creating a random notebook file'); const uri = await createRandomNotebookFile(); + console.log('Created a random notebook file'); return vscode.workspace.openNotebookDocument(uri); } @@ -119,6 +121,7 @@ const apiTestSerializer: vscode.NotebookSerializer = { } ] }; + console.log('Returning NotebookData in deserializeNotebook'); return dto; } }; @@ -159,39 +162,61 @@ const apiTestSerializer: vscode.NotebookSerializer = { }); test('cell execute command takes arguments', async () => { + console.log('Step1.cell execute command takes arguments'); const notebook = await openRandomNotebookDocument(); + console.log('Step2.cell execute command takes arguments'); await vscode.window.showNotebookDocument(notebook); + console.log('Step3.cell execute command takes arguments'); assert.strictEqual(vscode.window.activeNotebookEditor !== undefined, true, 'notebook first'); const editor = vscode.window.activeNotebookEditor!; const cell = editor.notebook.cellAt(0); + console.log('Step4.cell execute command takes arguments'); await withEvent(vscode.workspace.onDidChangeNotebookDocument, async event => { + console.log('Step5.cell execute command takes arguments'); await vscode.commands.executeCommand('notebook.execute'); + console.log('Step6.cell execute command takes arguments'); await event; + console.log('Step7.cell execute command takes arguments'); assert.strictEqual(cell.outputs.length, 1, 'should execute'); // runnable, it worked }); + console.log('Step8.cell execute command takes arguments'); await withEvent(vscode.workspace.onDidChangeNotebookDocument, async event => { + console.log('Step9.cell execute command takes arguments'); await vscode.commands.executeCommand('notebook.cell.clearOutputs'); + console.log('Step10.cell execute command takes arguments'); await event; + console.log('Step11.cell execute command takes arguments'); assert.strictEqual(cell.outputs.length, 0, 'should clear'); }); + console.log('Step12.cell execute command takes arguments'); const secondResource = await createRandomNotebookFile(); + console.log('Step13.cell execute command takes arguments'); const secondDocument = await vscode.workspace.openNotebookDocument(secondResource); + console.log('Step14.cell execute command takes arguments'); await vscode.window.showNotebookDocument(secondDocument); + console.log('Step15.cell execute command takes arguments'); await withEvent(vscode.workspace.onDidChangeNotebookDocument, async event => { + console.log('Step16.cell execute command takes arguments'); await vscode.commands.executeCommand('notebook.cell.execute', { start: 0, end: 1 }, notebook.uri); + console.log('Step17.cell execute command takes arguments'); await event; + console.log('Step18.cell execute command takes arguments'); assert.strictEqual(cell.outputs.length, 1, 'should execute'); // runnable, it worked assert.strictEqual(vscode.window.activeNotebookEditor?.notebook.uri.fsPath, secondResource.fsPath); }); + console.log('Step19.cell execute command takes arguments'); }); test('cell execute command takes arguments 2', async () => { + console.log('Step1.cell execute command takes arguments 2'); const notebook = await openRandomNotebookDocument(); + console.log('Step2.cell execute command takes arguments 2'); await vscode.window.showNotebookDocument(notebook); + console.log('Step3.cell execute command takes arguments 2'); let firstCellExecuted = false; let secondCellExecuted = false;