Skip to content

Commit f80b94a

Browse files
committed
feedback
1 parent e474b7e commit f80b94a

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

src/kernels/kernelAutoReConnectMonitor.unit.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ suite('Kernel ReConnect Failed Monitor', () => {
349349

350350
// Send the kernel into connecting state & then disconnected.
351351
kernel.kernelConnectionStatusSignal.emit('connecting');
352+
await clock.nextAsync();
352353
kernel.kernelConnectionStatusSignal.emit('disconnected');
353354
await clock.nextAsync();
354355

src/kernels/raw/session/rawSessionConnection.node.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
import type { Kernel, KernelMessage, ServerConnection, Session } from '@jupyterlab/services';
4+
import { type Kernel, type KernelMessage, ServerConnection, type Session } from '@jupyterlab/services';
55
import { Signal } from '@lumino/signaling';
6-
import { createRequire } from 'module';
76

87
import { logger } from '../../../platform/logging';
98
import { Resource } from '../../../platform/common/types';
@@ -18,8 +17,6 @@ import { trackKernelResourceInformation } from '../../telemetry/helper';
1817
import { RawKernelConnection } from './rawKernelConnection.node';
1918
import { generateUuid } from '../../../platform/common/uuid';
2019

21-
const require = createRequire(import.meta.url);
22-
2320
/*
2421
RawSession class implements a jupyterlab ISession object
2522
This provides enough of the ISession interface so that our direct
@@ -49,8 +46,7 @@ export class RawSessionConnection implements Session.ISessionConnection {
4946
}
5047
get serverSettings(): ServerConnection.ISettings {
5148
// We do not expect anyone to use this. Hence return a setting thats now expected to work, but at least compiles.
52-
const jupyterLab = require('@jupyterlab/services') as typeof import('@jupyterlab/services'); // NOSONAR
53-
return jupyterLab.ServerConnection.makeSettings({
49+
return ServerConnection.makeSettings({
5450
wsUrl: 'RAW'
5551
});
5652
}

src/platform/common/platform/fileUtils.node.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,14 @@ function pathExistsImpl(absPath: string): Promise<boolean> {
3131
return fsapi.pathExists(absPath);
3232
}
3333

34-
export function pathExistsSync(absPath: string): boolean {
34+
function pathExistsSyncImpl(absPath: string): boolean {
3535
return fsapi.pathExistsSync(absPath);
3636
}
3737

38+
export function pathExistsSync(absPath: string): boolean {
39+
return pathExistsSyncImpl(absPath);
40+
}
41+
3842
function readFileImpl(filePath: string): Promise<string> {
3943
return fsapi.readFile(filePath, 'utf-8');
4044
}
@@ -49,9 +53,15 @@ export const fileUtilsNodeUtils = {
4953
readFile: readFileImpl
5054
};
5155

52-
// Keep original exports for backwards compatibility
53-
export const pathExists = fileUtilsNodeUtils.pathExists;
54-
export const readFile = fileUtilsNodeUtils.readFile;
56+
// Delegation wrappers that call through fileUtilsNodeUtils at runtime
57+
// This allows test stubs to take effect
58+
export function pathExists(absPath: string): Promise<boolean> {
59+
return fileUtilsNodeUtils.pathExists(absPath);
60+
}
61+
62+
export function readFile(filePath: string): Promise<string> {
63+
return fileUtilsNodeUtils.readFile(filePath);
64+
}
5565

5666
export const untildify: (value: string) => string = (value) => untilidfyCommon(value, homedir());
5767

0 commit comments

Comments
 (0)