Skip to content

Commit a792cc4

Browse files
committed
fix tests
1 parent f8b3d80 commit a792cc4

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/kernels/kernel.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ abstract class BaseKernel implements IBaseKernel {
142142
return this._startedAtLeastOnce;
143143
}
144144
get userStartedKernel() {
145-
return this.startupUI.disableUI;
145+
return !this.startupUI.disableUI;
146146
}
147147
private _info?: KernelMessage.IInfoReplyMsg['content'];
148148
private _startedAtLeastOnce?: boolean;

src/standalone/api/kernels/api.vscode.common.test.ts

+13-5
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,12 @@ suiteMandatory('Kernel API Tests @typescript', function () {
115115

116116
// Even after starting a kernel the API should not return anything,
117117
// as no code has been executed against this kernel.
118-
await realKernel.start();
118+
await realKernel.start({
119+
disableUI: true,
120+
onDidChangeDisableUI: () => ({
121+
dispose: noop
122+
})
123+
});
119124
assert.isUndefined(await kernels.getKernel(notebook.uri));
120125

121126
// Ensure user has executed some code against this kernel.
@@ -253,7 +258,7 @@ suiteMandatory('Kernel API Tests @typescript', function () {
253258
const source = new CancellationTokenSource();
254259
let startEventCounter = 0;
255260
disposables.push(
256-
kernels.onDidStart(({ kernel }) => {
261+
kernels.onDidStart(async ({ kernel }) => {
257262
const codeToRun =
258263
startEventCounter === 0 ? `let foo = ${startEventCounter}` : `foo = ${startEventCounter}`;
259264
startEventCounter++;
@@ -280,10 +285,10 @@ suiteMandatory('Kernel API Tests @typescript', function () {
280285
disposables.push(eventHandler);
281286
await Promise.all([runCell(cell), waitForExecutionCompletedSuccessfully(cell), executionOrderSet.promise]);
282287

283-
// Validate the cell execution output is equal to the expected value of "foo = 1"
288+
// Validate the cell execution output is equal to the expected value of "foo = 0"
284289
const expectedMime = NotebookCellOutputItem.stdout('').mime;
285290
assert.isTrue(
286-
cellHasOutput(cell, '1', expectedMime),
291+
await cellHasOutput(cell, '0', expectedMime),
287292
'Invalid output, kernel start hook should execute code first'
288293
);
289294

@@ -297,7 +302,10 @@ suiteMandatory('Kernel API Tests @typescript', function () {
297302

298303
// Running the same cell again should not fire additional events
299304
await Promise.all([runCell(cell), waitForExecutionCompletedSuccessfully(cell), executionOrderSet.promise]);
300-
assert.isTrue(cellHasOutput(cell, '1', expectedMime));
305+
assert.isTrue(
306+
await cellHasOutput(cell, '0', expectedMime),
307+
'Invalid output, kernel start hook should only execute once'
308+
);
301309
assert.equal(startEventCounter, 1, 'Start event should not be triggered more than once');
302310
});
303311

0 commit comments

Comments
 (0)